akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<boost/algorithm/string/replace.hpp>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::algorithm;
using namespace boost::multiprecision;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;
const int MOD = 1e9+7;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//C++17以上
template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

template<typename T>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main(){
    int n;cin >> n;
    vector<int> h(n);
    rep(i,n)cin >> h[i];
    reverse(ALL(h));
    int ans = 0;
    int Max = -1;
    for(int i=0;i<n;i++){
        if(h[i+1]>=h[i]){
            ans++;
        }else{
            chmax(Max,ans);
            ans = 0;
        }
    }
    cout << Max << endl;
    return 0;
}

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

int main() {
    int r;
    cin >> r;
        if (r < 1200) cout << "ABC" << endl;
        else if ( r>= 1200 && r < 2800) cout << "ARC" << endl;
        else cout << "AGC" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

int main(void)
{
	int x = 0, fx = 0;
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		x += (s[i] - '0') * (pow(10, s.size() - i - 1));
		fx += s[i] - '0';
	}
	if (x % fx == 0) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

		String str = stdIn.next();
		String[] acgtArray = str.split("[^ACGT]");
		stdIn.close();

		int max = 0;
		for (String acgt : acgtArray) {
			int len = acgt.length();
			if(max < len) {
				max = len;
			}
		}

		System.out.println(max);
	}
}


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


void solve(long long A, long long B){
    cout << (A+B)%24 << endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

void E(int dice[]){
     int temp = dice[0];
     dice[0] = dice[3];
     dice[3] = dice[5];
     dice[5] = dice[2];
     dice[2] = temp;
}
void S(int dice[]){
     int temp = dice[0];
     dice[0] = dice[4];
     dice[4] = dice[5];
     dice[5] = dice[1];
     dice[1] = temp;
}
void W(int dice[]){
     int temp = dice[0];
     dice[0] = dice[2];
     dice[2] = dice[5];
     dice[5] = dice[3];
     dice[3] = temp;
}
void N(int dice[]){
     int temp = dice[0];
     dice[0] = dice[1];
     dice[1] = dice[5];
     dice[5] = dice[4];
     dice[4] = temp;
}
int main (){
    int dice[6];
    int i;
    for (i = 0;i < 6;i++){
        scanf ("%d",&dice[i]);   
    }
    char roll[101] = {0};
    scanf("%s",roll);
    int j = 0;
    do{
       switch(roll[j++]){
           case 'E': E(dice); break;
           case 'S': S(dice); break;
           case 'W': W(dice); break;
           case 'N': N(dice); break;
           default: printf ("error\n"); break;
       }
    }while(roll[j] != '\0');
    printf ("%d\n",dice[0]);
    return 0;
} 



Measured memory_bytes: 2056
import java.util.*;
import java.io.*;
 
public class Main {
    static long[] dist;
    static ArrayList<HashMap<Integer,Long>> root;
    static boolean[] arrived;
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        long[] arr = new long[n];
        Arrays.fill(arr,-1);
        for(int j = 0; j < n; j++){
            long tmp = sc.nextLong();
            int index = beamSearch(arr,tmp);
            arr[index] = tmp;
        }
        int ans = 0;
        for(int i = 0; i < n; i++){
            if(arr[i] == -1){
                break;
            }
            ans++;
        }
        System.out.println(ans);
    }
    
    public static int beamSearch(long[] arr, long chk){
        int left = -1;
        int right = arr.length;
        while(right - left > 1){
            int mid = (left + right) / 2;
            if(arr[mid] < chk){
                right = mid;
            }else{
                left = mid;
            }
        }
        return right;
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }
    
    public void close() throws Exception{
        this.reader.close();
        return;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 41024
import java.util.*;
public class Main
{
    public static void main(String []args)
    {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
            for(int i=0;i<1000;i++)
            {
                if((a+i)%1000==0)
                { 
                    System.out.println(i);
                    System.exit(0);
                }
            }
    }
}


Measured memory_bytes: 35772
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()
const long long INF = 1e18;
using namespace std;
typedef long long ll;
int main() {
  ll N;
  cin >> N;
  ll H[N];
  REP(i, N) { cin >> H[i]; }

  if (N == 1) {
    cout << "Yes";
    return 0;
  }

  ll max = H[0];
  FOR(i, 1, N) {
    if (H[i] == max) {
      continue;
    } else if (H[i] > max) {
      max = H[i] - 1;
    } else {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}

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

int main() {
  int s;
  cin >> s;
  int looooop = 0;
  int ind = 1;
  if (s == 1 || s == 2) {
    ind = 4;
    looooop = 2;
  }
  if (s == 4) looooop++;
  while (looooop < 2) {
    ind++;
    if (s % 2 == 0) {
      s /= 2;
    }else{
      s = 3 * s + 1;
    }
    if (s == 4) looooop++;
  }
  cout << ind << endl;
  return 0;
}


Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n):
        self.par = list(range(n + 1))
        self.size = [1] * (n + 1)

    def root(self, x: int) -> int:
        if self.par[x] == x: return x
        self.par[x] = self.root(self.par[x])
        return self.par[x]

    def unite(self, x: int, y: int):
        root_x, root_y = self.root(x), self.root(y)
        if root_x != root_y:
            if self.size[root_x] < self.size[root_y]:
                root_x, root_y = root_y, root_x
            self.size[root_x] += self.size[root_y]
            self.par[root_y] = root_x

    def check(self, x: int, y: int) -> bool:
        root_x, root_y = self.root(x), self.root(y)
        return root_x == root_y

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

u = UnionFind(N)

ABm = [0] * (N + 1)
for _ in range(M):
    a, b = map(int, input().split())
    ABm[a] += 1
    ABm[b] += 1
    u.unite(a, b)
    
CDk = [0] * (N + 1)
for _ in range(K):
    c, d = map(int, input().split())
    if u.check(c, d):
        CDk[c] += 1
        CDk[d] += 1
        
ans = []
for i in range(1, N + 1):
    size = u.size[u.root(i)]
    block = CDk[i]
    friends = ABm[i]
    res = size - block - friends - 1
    ans.append(str(res))

print(" ".join(ans))


Measured memory_bytes: 17480
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

#define MP make_pair
#define PB push_back
#define in int
#define ll long long
#define ull unsigned long long
#define vc vector
#define SQ(j) (j)*(j)
#define x first
#define y second
//
//#define ld long double
#define dbl  long double
#define pll pair<long long,long long>
#define pii pair<int,int>
#define pdd pair<dbl,dbl>
#define sz(xxx) ((int)(xxx.size()))
#define all(j) j.begin(), j.end()
#define loop(xxx, yyy) for(int xxx = 0; xxx < yyy; xxx++)
//#define printf(fmt, ...) (0)
//#define HOME
//#define y0 ngacaleiebinvoaeu
//#define y1 gnarpipipaigare
#define j1 adsfndnasfafoasp

//#define printf(...) (0)
#define db(x) if(DEBUG) {cout << #x << " = " << x << endl;}
#define dbCont(x) if(DEBUG) {cout << #x << ": "; for(auto shun: x) cout << shun << ' '; cout<<endl;}

using namespace std;

template<class K, class V>
ostream &operator<<(ostream &out, pair<K, V> &elem) {
    out << "{" << elem.first << "," << elem.second << "}";
    return out;
}


int DEBUG = 1;

using namespace std;

const ll MOD = 1000 * 1000 * 1000 + 7;
const int INF = 1000 * 1000 * 1000 + 7;


const int H = 10000 + 5;
vc<int> w,v;

int dp[H*2+123];

int main() {

    int h, n;
    cin >> h >> n;
    loop(i, n) {
        int weight, value;
        cin >> weight >> value;

        while(weight < 2*H){
            w.push_back(weight);
            v.push_back(value);

            weight *= 2;
            value *= 2;
        }
    }

    n = w.size();
//    db(n);

   loop(i,2*H) dp[i] = INF;
    dp[0] = 0;


    for(int i = 0; i < n; i++){
        for(int j = 2*H-1; j >= 0; j--){
            if(dp[j] != INF){
                if(j+w[i] < 2*H) {
                    dp[j+w[i]] = min(dp[j+w[i]], dp[j]+ v[i]);
                }
            }
        }
    }

    int ans = INF;
    for(int i = h; i < 2*H; i++){
        ans = min(ans, dp[i]);
    }


    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
class TreeNode {
	TreeNode left_  = null;
	TreeNode right_ = null;
	public TreeNode left{
		get {
			return left_;
		}
		set {
			left_ = value;
		}
	}
	public TreeNode right{
		get {
			return right_;
		}
		set {
			right_ = value;
		}
	}
	
	int key_;
	public int key {
		get {
			return key_;
		}
	}
	public TreeNode(int i) {key_ = i;}
};

interface ITraverser {
	void run(TreeNode start);
};
class PreOrderTraverser : ITraverser {
	public void run(TreeNode visitedNode) {
		if (visitedNode != null) {
			System.Console.Write(" {0}", visitedNode.key);
			run(visitedNode.left);
			run(visitedNode.right);
		}
	}
};
class MidOrderTraverser : ITraverser {
	public void run(TreeNode visitedNode) {
		if (visitedNode != null) {
			run(visitedNode.left);
			System.Console.Write(" {0}", visitedNode.key);
			run(visitedNode.right);
		}
	}
};

class BinarySearchTree {
	
	static void insert (ref TreeNode root, TreeNode newNode)
	{
		TreeNode y = null;
		TreeNode x = root;
		while (x != null) {
			y = x; //???????¨????
			if (newNode.key < x.key) {
				x = x.left;
			}
			else {
				x = x.right;
			}
		}
		
		if (y == null) {// T???????????´???
		    root = newNode;
			//System.Console.WriteLine("root Assign: {0}",newNode.key); 
		}
		else if (newNode.key < y.key) {
			y.left = newNode; // newNode???y?????????????????????
			//System.Console.WriteLine("insert left: {0} -> {1}",y.key, newNode.key); 
		}
		else {
			y.right = newNode; // newNode???y?????????????????????
			//System.Console.WriteLine("insert right: {0} -> {1}",y.key, newNode.key); 
		}
	}

	public static void Main() {
		var line = System.Console.ReadLine();
		int inputCount = int.Parse(line);
		
		TreeNode root = null;
		ITraverser[] traverser = new ITraverser[2];
		traverser[0] = new MidOrderTraverser();
		traverser[1] = new PreOrderTraverser();
		for (int i = 0; i < inputCount; ++i) {
			line = System.Console.ReadLine();
			string[] input = line.Split(' ');
			switch (input[0]) {
			  case "insert":
				int value = int.Parse(input[1]);
				insert(ref root, new TreeNode(value));
				break;
			  case "print":
				traverser[0].run(root);
				System.Console.WriteLine("");
				traverser[1].run(root);
				System.Console.WriteLine("");
				break;
			  default: //bkyk
				System.Console.WriteLine("What?? readline = {0}", line);
				break;
			}
		}
	}
};

Measured memory_bytes: 40392
#include <cstdio>
#include <algorithm>
using namespace std;
int n,m,f[100005],g[100005];

void zzk(int L,int R){
	for (int k=1,kk,kkk,a,Max,Min; k<=m && k<=R;){
		// k<=kk<=(l-1)/a
		a=(L-1)/k;
		if (a==0) Max=99999999; else Max=(L-1)/a; Min=k-1;
		kk=R/(a+1);
		kk=min(kk,Max); kk=max(kk,Min);
		f[k]++; f[kk+1]--;
		k=Max+1;
	}
}

int main(){
	scanf("%d%d",&n,&m);
	for (int i=1,l,r; i<=n; i++){
		scanf("%d%d",&l,&r);
		zzk(l,r);
	}
	for (int i=1; i<=m; i++) g[i]=g[i-1]+f[i],printf("%d\n",g[i]);
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#include <string.h>
#include <math.h>

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265359

int main(void)
{
	int n;
	vector<int> s(1001);
	long total;
	double m,a,ans;

	while (true) {
		cin >> n;
		if (n == 0)
			break;

		total = 0;
		rep(i, n) {
			cin >> s.at(i);
			total += s.at(i);
		}
		m = (double)total / n;
		a = 0;
		rep(i, n)
			a += pow(s.at(i) - m, 2);
		ans = sqrt((double)a / n);
		cout << fixed << setprecision(10) << ans << endl;
	}
}



Measured memory_bytes: 3264
#include <bits/stdc++.h>
  using namespace std;
 
int main(){
  int N;
  cin>>N;
  vector<int> A(N),B(N),C(N-1);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  for(int i=0;i<N;i++){
    cin>>B.at(i);
  }
  for(int i=0;i<N-1;i++){
    cin>>C.at(i);
  }
  int count=0;
  int lastItem=-1;
  for(int i=0;i<N;i++){
    int checker=A.at(i);
    count+=B.at(checker-1);
    if(checker==lastItem+1){
      count+=C.at(checker-2);
    }
    lastItem=checker;
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    char s1[10],s2[10],s3[10],temp,temp2,temp3;
    scanf("%s %s %s",&s1,&s2,&s3);
    temp=s1[0];
    temp=temp-32;
    temp2=s2[0];
    temp2=temp2-32;
    temp3=s3[0];
    temp3=temp3-32;
    printf("%c%c%c\n",temp,temp2,temp3);
    return 0;

}


Measured memory_bytes: 1724
#include <cstdio>
#include <cmath>
using namespace std;

int main(){
	double n,d;
	scanf("%lf %lf",&n,&d);
	int cnt=0;
	for(int i=0;i<n;i++){
		double x,y;
		scanf("%lf %lf",&x,&y);
		if(sqrt(x*x+y*y)<=d) cnt++;
	}
	printf("%d\n",cnt);
	
	return 0;
}
    

Measured memory_bytes: 2184
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
p = LIST()
s = sorted(p)
# print(p)
# print(s)
cnt = 0
for i in range(n):
    if p[i] != s[i]:
        cnt += 1
if cnt == 2 or cnt == 0:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 5708
#include <bits/stdc++.h>
using namespace std;
int main(){
        int fir, sec;
        bool f=0;
		bool s=0;
		scanf("%2d%2d", &fir, &sec);
        if (1 <= fir && fir <= 12){
                f = 1;
        }
        if (1 <= sec && sec <= 12){
                s = 1;
        }
        if (f && s) {
                printf("AMBIGUOUS");
        } else if (f) {
                printf("MMYY");
        } else if (s) {
                printf("YYMM");
        } else {
                printf("NA");
        }

        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int maxn=0x7fffff;
int od,ev,fo;
int main(){
	int n;
	cin>>n;
	while(n--){
		int x;
		cin>>x;
		if(x%4==0){
			fo++;
		}
		if(x%2==0&&x%4!=0){
			ev++;
		}
		if(x%2!=0){
			od++;
		}
	}
	string ans;
	if(ev==0){
		if(od<=fo+1)ans="Yes";
		else ans="No";
	}
	else {
		if(od<=fo) ans="Yes";
		else ans="No";
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;


const int MAX = 2 * 100001;
const int MOD = 1000000007;

typedef long long ll;

ll factorial[MAX], factorialInvers[MAX], invers[MAX];

void ComInit(){
    factorial[0] = factorial[1] = 1;
    factorialInvers[0] = factorialInvers[1] = 1;
    invers[1] = 1;
    for (int i = 2; i < MAX; i++)
    {
        factorial[i] = factorial[i - 1] * i % MOD;
        invers[i] = MOD - (MOD / i) * invers[MOD % i] % MOD;
        factorialInvers[i] = factorialInvers[i - 1] * invers[i] % MOD;
    }
}

ll Combination(ll n,ll k)
{
    if(n<k || k<0)
        return 0;
    return (factorial[n] * factorialInvers[k] % MOD) * factorialInvers[n - k] % MOD;
}
ll Homogeneous(ll n,ll k)
{
    return Combination(n + k - 1, k) % MOD;
}

int main(){
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    ComInit();
    for (ll i = 0; i <= k && i < n; i++)
    {
        ans += Combination(n, i) * Homogeneous(n - i, i);
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4992
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Yagnik
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DBannedK solver = new DBannedK();
        solver.solve(1, in, out);
        out.close();
    }

    static class DBannedK {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            int n = s.nextInt(), MX = (int) 2e5 + 1;
            long[] f = new long[MX];
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = s.nextInt();
                f[a[i]]++;
            }
            long ans = 0;
            for (int i = 0; i < MX; i++) ans += f[i] * (f[i] - 1) >> 1;
            for (int i = 0; i < n; i++) w.println(ans - f[a[i]] + 1);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 38192
n = int(input())
l = sorted(list(map(int, input().split())))

res = 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] != l[k] and l[i] + l[j] > l[k]:
                res += 1

print(res)

Measured memory_bytes: 68080
//g++ -std=c++14 test.cpp -o test.out

//問題URL
//https://atcoder.jp/contests/agc019/tasks/agc019_b

//参考：
//https://oraclesqlpuzzle.ninja-web.net/kyoupro/kyoupro-10-019-b.html

//ポイント：
//A[i]とA[j]が同じ文字の時、
//それに内包される文字列を反転させたものと
//A[i],A[j]を含んだ文字列を反転させても被るので除外する
//例えば
//文字列eabceにおいてはabc,eabceどちらを反転させても
//同じecbaeができる

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N,T;
LL A[100000];

LL ans = 0;

void solve(){
	//i<jかつA[i]<A[j]となるようなもののうち、
	//A[i]とA[j]の差が最大になるような(i,j)の個数が答えとなる
	//ただし各組のi,jは相異なっていなければならない
	//{(1,2)(7,10)}とかはいいけど{(1,2),(2,3)}とかダメ
	LL max_value = A[N-1];
	LL max_diff = 0;
	for(int i=N-2;i>=0;i--){
		max_diff = max(max_diff,max_value - A[i]);
		max_value = max(max_value,A[i]);
		//cout << max_diff <<" " <<max_value << endl;
	}

	max_value = A[N-1];
	LL max_index = N-1;
	vector<int> used(N,0);
	for(int i=N-2;i>=0;i--){
		if(max_value-A[i]==max_diff){
			if(used[i]==0 && used[max_index]==0){
				ans++;
				used[i] = 1;
				used[max_index] = 1;
			}
		}
		if(max_value<A[i]){
			max_value = A[i];
			max_index = i;
		}
	}
}
 
int main(){
    cin >> N >> T;
    for(int i=0;i<N;i++) cin >> A[i];
 
    solve();

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

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000009
#define ll long long
#define mp make_pair
#define pb push_back
#define nl printf("\n")
#define ff first
#define ss second
#define set0(a) memset ((a), 0 , sizeof(a))
#define set1(a) memset((a),-1,sizeof (a))
#define pi pair<int, int>
#define ps pair<string, string>
#define pl pair<long, long>
#define pll pair<long long, long long>
#define vll vector<long long>
#define vl vector<long>
#define vi vector<int>
#define vs vector<string>
#define vps vector< ps >
#define vpi vector< pi >
#define vpl vector< pl >
#define vpll vector< pll >
#define flash  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc(t,T) for(long long t=0;t<T;t++)
#define rep(i,s,n,d) for(long long i=s;i<n;i=i+d)
const int todx[] = { -2, -2, -1, -1,  1,  1,  2,  2 };
const int tody[] = { -1,  1, -2,  2, -2,  2, -1,  1 };
bool sortbysec(const pll &a,
              const pll &b)
{
    return (a.second < b.second);
}
/*bool cxp pair<ll, pll> &a,
              const pair<ll, pll> &b)
{
    return (a.ff < b.ff);
}*/

void func(void)
{
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
}
ll gcd(ll a,ll b){
    if(b==0)return a;
    else return gcd(b,a%b);
}
void printStack(stack<string> s){
    if(s.empty())return;

    string x=s.top();
    s.pop();
    printStack(s);
    cout<<x;
    s.push(x);

}


ll binaryexp(ll n,ll p){

    if(p==0) return 1;
    if(p%2==0) return binaryexp((n%mod)*(n%mod),p/2);
    else return ((n%mod)*binaryexp(((n%mod)*(n%mod))%mod,(p-1)/2)%mod);

}

#define meax 10000001
vll spf(meax,0);
void siv(){
    spf[1]=1;

   for(ll i=2;i<meax;i++)spf[i]=i;

   for(ll i=4;i<meax;i+=2){
        spf[i]=2;
    }
    for(ll i=3;i*i<meax;i++){
        if(spf[i]==i){
            for(ll j=i*i;j<meax;j+=i){
                if(spf[j]==j){
                    spf[j]=i;
                }
            }
        }
    }
}


int main(){
    double D,T,S;
    cin>>D>>T>>S;
    double ans=D/S;
    if(ans<=T){
        cout<<"Yes\n";

    }
    else cout<<"No\n";
}


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

int main() {
  string S, T;
  cin >> S >> T;
  int A, B;
  cin >> A >> B;
  string U;
  cin >> U;
  if (U == S) {
    A -= 1;
  } else {
    B -= 1;
  }
  cout << A << " " << B;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdio.h>
int main()
{
    int a,b,c,d,n;
    while(scanf("%d",&n)!=EOF)
    {   a=n/1000;
        b=(n-1000*a)/100;
        c=n%100/10;
        d=n%10;
        if(a+b+c+d==7)printf("%d+%d+%d+%d=7\n",a,b,c,d);
        else if(a+b+c-d==7)printf("%d+%d+%d-%d=7\n",a,b,c,d);
        else if(a+b-c+d==7)printf("%d+%d-%d+%d=7\n",a,b,c,d);
        else if(a-b+c+d==7)printf("%d-%d+%d+%d=7\n",a,b,c,d);
        else if(a+b-c-d==7)printf("%d+%d-%d-%d=7\n",a,b,c,d);
        else if(a-b-c+d==7)printf("%d-%d-%d+%d=7\n",a,b,c,d);
        else if(a-b+c-d==7)printf("%d-%d+%d-%d=7\n",a,b,c,d);
    }
    return 0;
}


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

using namespace std;
#define rep(i, n) for(int i = 0 ; i < (int)(n) ; i++)
typedef long long ll;
typedef long double Double;

#ifndef INPUTS_DIR
#define INPUTS_DIR "./"
#endif


bool ok(string S, int l) {
    vector<bool> alive(S.size(), false);
    for (int i = 0; i < S.size() - l; i++) {
        alive[l + i] = true;
        alive[i] = true;
    }

    int bit = 0;
    for (int i = 0; i < alive.size(); i++)
        if (alive[i] == false) bit |= 1 << (S[i] == '1');

    return bit != 3;
}

void solve(string S) {
    int l = 1, r = S.size();
    while (l != r) {
        int m = (l + r + 1) / 2;
        if (ok(S, m)) {
            l = m;
        } else {
            r = m - 1;
        }
    }
    cout << l << endl;
}


void main_(istream &cin) {
    string S;
    cin >> S;
    solve(S);
}

int main() {
#ifdef INTELLIJ
    ifstream ifs(string(INPUTS_DIR) + "in_1.txt");
    if (ifs.is_open()) {
        main_(ifs);
        ifs.close();
    } else {
        cerr << "Error: no input." << endl;
    }
#else
    ios::sync_with_stdio(false);
    cin.tie(0);
    main_(cin);
#endif
}





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

using ll = long long;

const ll mod = 1000000007;
const int INF = 1000000000;
const double EPS = 1e-9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<int> s(M), c(M);
    for (int i = 0; i < M; ++i) {
        cin >> s[i] >> c[i];
        s[i]--;
    }
    int mi = pow(10, N - 1);
    int ans = -1;
    for (int i = (mi == 1 ? 0 : mi); i < mi * 10; ++i) {
        string str = to_string(i);
        int ok = true;
        for (int j = 0; j < M; ++j) {
            if (str[s[j]] != '0' + c[j]) ok = false;
        }
        if (ok) {
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}


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

using namespace std;

typedef long long ll;

ll a[5005];

int main(){

	int N;

	ll K;

	scanf("%d %lld",&N,&K);

	int i;

	for(i=0;i<N;i++){
		scanf(" %lld",&a[i]);
	}

	sort(a,a+N);

	ll t=0ll;
	int ans=N;

	for(i=N-1;i>=0;i--){
		if(t+a[i]<K){
			t+=a[i];
		}
		else{
			ans=min(ans,i);
		}
	}
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 256
n, a, b = map(int, input().split())
mod = 10 ** 9 + 7


def comb_mod(n, k, mod):
    numerator = 1
    denominator = 1
    for i in range(k):
        numerator = (numerator * (n - i)) % mod
        denominator = (denominator * (i + 1)) % mod

    return (numerator * pow(denominator, mod - 2, mod)) % mod


n_c_a = comb_mod(n, a, mod)
n_c_b = comb_mod(n, b, mod)

result = (pow(2, n, mod) - 1 - n_c_a - n_c_b) % mod
print(result)


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a<0&&b<0)
	{
		if((a-b+1)%2==0)//偶数个
		{
			cout<<"Positive"<<endl;
		}
		else
		{
			cout<<"Negative"<<endl;
		}
	}
	else if(a>0&&b>0)
	{
		cout<<"Positive"<<endl;
	}
	else
	{
		cout<<"Zero"<<endl;
	}
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   for(int i=0;i<(n);++i)
#define SORT(c)    sort((c).begin(),(c).end())
const double EPS = 1e-10;//sample:if((double)>=(double)+EPS)
#define CLR(a) memset((&a), 0 ,sizeof(a))//clear memory
#define dump(x)  cerr << #x << " = " << (x) << endl;//debug
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
//cin,cout release
//std::cin.tie(0);
//ios::sync_with_stdio(false);
int cnt=0,n;

using namespace std;
void koch(int n,double p1x, double p1y, double p2x, double p2y){
  double sx,sy,tx,ty,ux,uy,th=M_PI*60.00/180.0;
  if(n==0)return;
  sx=(2.0*p1x+p2x)/3;
  sy=(2.0*p1y+p2y)/3;
  tx=(p1x+2.0*p2x)/3;
  ty=(p1y+2.0*p2y)/3;
  ux=(tx-sx)*cos(th)-(ty-sy)*sin(th)+sx;
  uy=(tx-sx)*sin(th)+(ty-sy)*cos(th)+sy;
  koch(n-1,p1x,p1y,sx,sy);printf("%.8f %.8f\n",sx,sy);
  koch(n-1,sx,sy,ux,uy);printf("%.8f %.8f\n",ux,uy);
  koch(n-1,ux,uy,tx,ty);printf("%.8f %.8f\n",tx,ty);
  koch(n-1,tx,ty,p2x,p2y);
  cnt++;
  
  
  
  
}
int main(){
  cin>>n;
  printf("%.8f %.8f\n",0.0,0.0);
  koch(n,0,0,100,0);
  printf("%.8f %.8f\n",100.0,0.0);
  return 0;
}



Measured memory_bytes: 3224
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define pye cout << "yes" << endl;
#define pno cout << "no" << endl;
#define pYe cout << "Yes" << endl;
#define pNo cout << "No" << endl;
#define pYE cout << "YES" << endl;
#define pNO cout << "NO" << endl;;
#define prin(num) cout << num << endl;
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define mp make_pair
#define INF 100000000000
#define MOD 1000000007LL
#define MAX 100005
#define NIL -1
#define WHITE 0
#define BLACK 1
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;



int main(void) {
    ll N, i, a[MAX];
    cin >> N;
    for(i=0; i<N; i++) {
        cin >> a[i];
    }
    sort(a, a+N);
    
    Map map;
    for(i=0; i<N; i++) {
        map[a[i]]++;
    }
    vector<ll> v;
    for(auto it=map.begin(); it!=map.end(); it++) {
        if((it->second)%2==0) {
            it->second=2;
        }else {
            it->second=1;
        }
        v.push_back(it->second);
    }
    
    ll cnt=0;
    for(i=0; i<v.size(); i++) {
        if(v[i]%2==0) cnt++;
    }
    
    if(cnt%2==0) {
        prin(v.size());
    }else {
        prin(v.size()-1);
    }
    
}

Measured memory_bytes: 8444
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int ans = (X/500)*1000 + ((X%500)/5)*5;
        System.out.println(ans);
    }
}


Measured memory_bytes: 35732
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>
#include <queue>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())

const int MOD = 1000000007;
const int INF = INT_MAX;


// a,bの最小公倍数
ll lcm(ll a, ll b){ll lcm = a * b; ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return lcm /= b;}
// a,bの最大公約数
ll gcd(ll a, ll b){ll r = a % b;while(r != 0){a = b; b = r; r = a % b;}return b;}
// MOD
ll modadd(ll a, ll b){return (a%MOD+b%MOD+MOD)%MOD;}
ll modmul(ll a, ll b){return a%MOD*b%MOD%MOD;}
ll modexp(ll a, ll n){if(n==0)return 1; if(n%2==0){ll e=modexp(a,n/2); return modmul(e,e);} return modexp(a,n-1)*a%MOD;}
ll modinv(ll n){return modexp(n%MOD,MOD-2);}
ll modfact(ll n){ll res=1; for (int i=1; i <= n; ++i){res *= i; res %= MOD;} return res;}
ll modncr(ll n, ll r){ll numer=1;ll denom=1;for(int i=1;i<=r;++i){numer=modmul(numer,n-r+i);denom=modmul(denom,i);}return modmul(numer, modinv(denom));}


int main(){

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

    bool flag = false;
    for (int k = 1; k <= 100; ++k) {
        if ((a*k - c) % b == 0) {
            flag = true;
        }
    }
    
    if (flag) cout << "YES" << endl;
    else cout << "NO" << endl;




}



//              g++ -std=c++1z


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top = 0, S[1000];

void push(int x){
 S[++top] = x;
}

int pop(void){
 top--;
 return S[top+1];
}

int main(void){
 int a, b;
 top = 0;
 char s[100];
 while(scanf("%s",s) != EOF){
  if(s[0] == '+'){
   a = pop();
   b = pop();
   push(a + b);
  }else if(s[0] == '-'){
   b = pop();
   a = pop();
   push(a - b);
  }else if(s[0] == '*'){
   a = pop();
   b = pop();
   push(a * b);
  }else{
   push(atoi(s));
  }
 }
 printf("%d\n",pop());

 return 0;
}


Measured memory_bytes: 2104
/**Bismillahir Rahmanir Rahim.**/
#include<bits/stdc++.h>
#define ln '\n'
#define D(x) cout<< #x " = "<<x<<endl
#define foreach(i,c) for(__typeof(c.begin())i=c.begin();i!=c.end();i++)

#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define _case cout<<"Case "<<++cs<<": "

#define MOD 1000000007
#define countv(v,a) count(v.begin(),v.end(),a)
#define grtsrt(v) sort(v.begin(),v.end(),greater<int>())
#define mnv(v) *min_element(v.begin(),v.end())
#define mxv(v) *max_element(v.begin(),v.end())
#define uniq(v) v.resize( unique(all(v)) - v.begin())

#define PI acos(-1)
#define ll long long int
#define ull unsigned long long

#define vi vector <int>
#define vll vector <ll>
#define vs vector <string>
#define pb push_back
#define mpii map <int,int>
#define mpsi map <string,int>
#define mpll map <long long,long long>
#define MP make_pair
#define F first
#define S second

#define GCD(a,b) __gcd(a,b)
#define LCM(a,b) (a*(b/__gcd(a,b)))

#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())

#define all(v) v.begin(),v.end()
#define MEM(a, b) memset(a, b, sizeof(a))

#define fast ios_base::sync_with_stdio(false)
using namespace std;

const ll INF = 0x3f3f3f3f3f3f3f3f;
const long double EPS = 1e-9;
const int inf = 0x3f3f3f3f;
/// count set bit C = (num * 0x200040008001ULL & 0x111111111111111ULL) % 0xf; /// 32 bit integer

/*------------------------------Graph Moves----------------------------*/
//Rotation: S -> E -> N -> W
//const int fx[] = {0, +1, 0, -1};
//const int fy[] = {-1, 0, +1, 0};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*---------------------------------------------------------------------*/

//Bit Operations
inline bool checkBit(ll n, int i)
{
    return n&(1LL<<i);
}
inline ll setBit(ll n, int i)
{
    return n|(1LL<<i);
}
inline ll resetBit(ll n, int i)
{
    return n&(~(1LL<<i));
}


inline bool isSquare(ll x)
{
    ll s = sqrt(x);
    return (s*s==x);
}
inline bool isFib(ll x)
{
    return isSquare(5*x*x+4)|| isSquare(5*x*x-4);
}
inline bool isPowerOfTwo(ll x)
{
    return ((1LL<<(ll)log2(x))==x);
}

typedef struct
{
    double x,y;
    /// Point() {}
    ///  Point(double x,double y) : x(x), y(y) {}
} Point;

double distance(Point a, Point b)
{
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}

int main()
{
    ll n, p;
    cin >> n >> p;

    if (n==1)
    {
        cout << p << endl;
        return 0;
    }

    ll ans = 1;

    for (ll i=2; i*i<=p; i++)
    {
        if (p%i==0)
        {
            int k = 0;
            while (p%i==0 && p>0)
            {
                p /= i;
                k++;
            }
      //  D(k);
            k /= n;
            ans *= pow(i, k);
         //   D(ans);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static ArrayList<String> s = new ArrayList<String>();
	public static void main(String[] args) throws IOException {
		FastScanner in = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		String s= in.next();
		boolean good= true;
		for (int i = 0; i < s.length(); i++) {
			if(s.charAt(i)!=s.charAt(s.length()-i-1)) good= false;
		}
		if(good) System.out.println("Yes");
		else System.out.println("No");
	}
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
			st = new StringTokenizer("");
		}

		public double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		public String next() throws IOException {
			if (!st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
				return next();
			}
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
	}
}



Measured memory_bytes: 22996
if __name__ == '__main__':
    (A, B, M) = tuple(map(int, input().split()))
    rf_prices = list(map(int, input().split()))
    rg_prices = list(map(int, input().split()))
    d_tickets = [list(map(int, input().split())) for _ in range(M)]
    min_with_ticket = min([rf_prices[t[0]-1]+rg_prices[t[1]-1]-t[2] for t in d_tickets])
    min_with_none_ticket = min(rf_prices)+min(rg_prices)
    print(min(min_with_none_ticket, min_with_ticket))

Measured memory_bytes: 42408
#include <bits/stdc++.h>
#define lp(n) for(int i = 0; i < n; i++)
#define LP(i, a, n) for(int i = a; i < n; i++)
#define lpp(i, n) for(int i = 0; i < n; i++)
using namespace std;
int N;
int check(int a[], int n, int s, int q) {
  if(s == q) return 1;
  else if(n == N) return 0;
  else if(check(a, n+1, s + a[n], q)||check(a, n+1, s, q)) return 1;
  return 0;
}
int main() {
  int q, b, c=0;
  int a[20];
  cin >> N;
  lp(N) cin >> a[i];
  cin >> q;
  lp(q) {
    cin >> b;
    cout << (check(a,0,0,b)?"yes":"no") << endl;
  }
  return 0;
}




Measured memory_bytes: 3120
#include<bits/stdc++.h>
#define mx 400005
using namespace std;

bool used[mx], ok = true;
int n, a[mx];
long long ans;

int main(){
	scanf("%d", &n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);
	for(int i = n-1; i >= 0; i--){
		if(a[i] > i || (i != n-1 && a[i] < a[i+1] - 1)){
			ok = false;
			break;
		}
		if(!used[n-i+a[i]]){
			used[n-i+a[i]] = true;
			ans += a[i];
		}
	}
	printf("%lld", ok ? ans : -1);
}


Measured memory_bytes: 1280
import java.util.Scanner;

class Main{

public static void main(String args[]){
Scanner sc=new Scanner(System.in);

int[] buf=new int[3];

for(int i=0;i<buf.length;i++){
    buf[i]=sc.nextInt();
}

int work;
for(int i=0;i<buf.length;i++){
   for(int j=0;j<buf.length-i-1;j++){
       if(buf[j]>buf[j+1]){
            work=buf[j];
            buf[j]=buf[j+1];
            buf[j+1]=work;
       }
   }
}


System.out.print(buf[0]+" "+buf[1]+" "+buf[2]);
System.out.println();

sc.close();
}

}


Measured memory_bytes: 26184
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
#include <random>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
typedef vector<vvpl> vvvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    sort(ALL(vec));
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const stc& lhs, const stc& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N, M; cin >> N >> M;
    vs A(N); rep(i, N) cin >> A[i];
    vs B(M); rep(i, M) cin >> B[i];
    
    for(int i = 0; i+M-1 < N; i++){
        for(int j = 0; j+M-1 < N; j++){
            bool ok = true;
            rep(k, M) rep(l, M){
                if(A[i+k][j+l] != B[k][l]) ok = false;
            }
            if(ok){
                cout << "Yes" << endstr; return 0;
            }
        }
    }
    cout << "No" << endstr;
    return 0;
}


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

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
  #define cerrendl 42
#endif
//}}}

vector<int> sieve(int n) {  // エラトステネスのふるい O(NloglogN){{{
  // 素数の集合を得たい場合はsort, uniqueをすればよい。
  vector<int> primes(n);
  for (int i = 2; i < n; ++i)
    primes[i] = i;
  for (int i = 2; i*i < n; ++i)
    if (primes[i])
      for (int j = i*i; j < n; j+=i)
        primes[j] = 0;
  return primes;
}//}}}

signed main() {
  int n,k,s;cin>>n>>k>>s;

  auto ps = sieve(1000000);
  // dump(ps);
  int y;
  rep(d, 1, 1000000){
    if (s%d!=0){
      y = d;
      break;
    }
  }
  dump(y);

  vi ans;
  rep(i, k){
    ans.pb(s);
  }
  rep(i, n-k){
    ans.pb(y);
  }
  rep(i, sz(ans)) cout << ans[i] << (i!=sz(ans)-1 ? " " : "\n");

  return 0;
}


Measured memory_bytes: 10100
#include <iostream>

int main() {
  int n, k; std::cin >> n >> k;
  int h[n];
  for(size_t i = 0; i < n; ++i) std::cin >> h[i];
  int tmp = 0;
  for(size_t i = 0; i < n; ++i)
    if(h[i] >= k) tmp++;
  std::cout << tmp;
  return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int i,n;
		int a,b,count_a,count_b;
		
		while(true){
			count_a=count_b=0;
			n=sc.nextInt();
			if(n==0) break;

			for(i=0;i<n;i++){
				a=sc.nextInt();
				b=sc.nextInt();
				if(a==b){
					count_a+=a;
					count_b+=b;
				}
				else if(a>b){
					count_a+=(a+b);
				}
				else if(b>a){
					count_b+=(a+b);
				}
			}
			System.out.println(count_a+" "+count_b);
		}
	}
}

Measured memory_bytes: 12000
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	charCount := make(map[int32]int, 0)
	for _, char := range s {
		charCount[char] += 1
	}
	if len(Keys(charCount)) == 2 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func Keys(m map[int32]int) []int32 {
	var ks []int32
	for k := range m {
		ks = append(ks, k)
	}
	return ks
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int height(int x) {
	if(x == 1) return 1;
	return x + height(x-1);
}

int main() {
	int a, b;
    cin >> a >> b;
	cout << height(b - a) - b << endl;
}


Measured memory_bytes: 256