akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const double PI=3.14159265358979323846;
#define int long long int
signed main(){
    int n,m;cin>>n>>m;
    vector<int> h(n,0);
    vector<vector<int>> v(n);
    for(int i=0;i<n;i++)cin>>h[i];
    for(int i=0;i<m;i++){
        int a;cin>>a;
        int b;cin>>b;
        v[a-1].push_back(b-1);
        v[b-1].push_back(a-1);
    }
    int sum=0;
    for(int i=0;i<n;i++){
        int cnt=0;
        for(int j=0;j<v[i].size();j++){
            if(h[i]>h[v[i][j]])cnt++;
        }
        if(cnt==v[i].size())sum++;
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 9848
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S,T;
  cin>>S>>T;
  
  int sw=0;
  
  for(int i=0;i<S.size();i++){
    if(S.at(i)!=T.at(i)){
      sw++;
    }
  }
  
  cout<<sw<<endl;
  
    
}




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

using namespace std;
typedef long long ll;

int n;
int S[100005];
ll sumi[100005];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> S[i];
    }
    ll ans = 0;
    for (int AB = 1; AB < n - 2; AB++) {
        for (int i = n - 1 - AB; i > 0; i -= AB) {
            sumi[i] = sumi[i + AB] + S[i];
        }
        ll sumx = 0;
        for (int i = AB; i < n - 1; i += AB) {
            int A = n - 1 - i;
            sumx += S[i];
            if (AB >= A) continue;
            if (A <= i && A % AB == 0) continue;
            ans = max(ans, sumx + sumi[A]);
        }
    }
    cout << ans;
}

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

int main() {
  string s;
  cin>>s;
  int n=s.size();
  string ans="yes";
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      if(s[i]==s[j]) ans="no";
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
def five_variable():
    variables = [int(i) for i in input().split()]

    if variables[4] == 0:
        result = variables[3] + 1     
    elif variables[0] == 0:
        result = variables[1] - 1 
    elif variables[1] == 0:
        result = variables[2] - 1 
    elif variables[2] == 0:
        result = variables[3] - 1
    elif variables[3] == 0 :
        result = variables[4] -1 

    print(result)
    

five_variable()

Measured memory_bytes: 9200
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>

using namespace std;
int a,b,c,i,j,k,n;
string s;
int main()
{
    while(scanf("%d",&a)==1)
    {
      b=a/100;
      a=a%100;
      if((a>12||a==0)&&(b>12||b==0))
        printf("NA\n");
      else
        if((a<=12&&a>0)&&(b<=12&&b>0))
        printf("AMBIGUOUS\n");
      else if((a>12||a==0))
        printf("MMYY\n");
      else
        printf("YYMM\n");
    }
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <sstream> //string stream its useful!
#include<string>
#include<iostream>
#include<utility> //pair
#include <vector> // vector
#include <algorithm>    // swap,sort,binary_search
#include <functional>   // std::greater
#include <map> //map
#include<set> //set
#include<queue> //queue
#include<list> //list
#include<cmath>
#include<numeric>
#include<cassert>
#include <iomanip> //cout<<setprecision

typedef long long ll;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

using namespace std;
void omajinai() {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(15);
    //freopen("txt.csv","r",stdin);
}

int main(){
    omajinai();
    long N,x;
    cin>>N>>x;
    vector<long> a(N,0);
    for(int i =0 ; i<N;i++) cin>>a[i];
    long ans = 0;
    for(int i = 1; i<N;i++) if(a[i-1]+ a[i] > x){
        ans += a[i-1] + a[i] - x;
        a[i] = x- a[i-1];
        if(a[i] < 0){
            a[i-1]+= a[i];
            a[i] = 0;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1152
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int sum = sc.nextInt();
		int a = 0;
		String b = String.valueOf(sum);
		if(sum%10 == 0){
			a = 10;
		}else{
			String[] c = b.split("",0);
			int[] d = new int[c.length];
			for(int j = 0; j < c.length; j++){
				d[j] = Integer.parseInt(c[j]);
			}
			for(int i = 0; i < d.length; i++){
				a += d[i];
			}
		}
		System.out.println(a);
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
      }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;


signed main(){
  int a, b;
  scanf("%lld%lld", &a, &b);
  if(b%a == 0)printf("%lld", a+b);
  else printf("%lld\n", b-a);
  return 0;
}








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

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

const int N = 2e5+10 , mod = 1e9+7;

int cnt[N];

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   int n;
   cin >> n;
   ll ans = 0;
   for(int i = 0 ; i < n ; i++){
      int x;
      cin >> x;
      cnt[x]++;
      ans += x;
   }
   int q;
   cin >> q;
   while(q--){
      int a , b;
      cin >> a >> b;
      ans -= 1ll * cnt[a] * a;
      ans += 1ll * cnt[a] * b;
      cnt[b] += cnt[a];
      cnt[a] = 0;
      cout << ans << "\n";
   }
   return 0;
}


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

const int N_MAX = 100;
int s[N_MAX + 10];
int N;

int main(){
  cin >> N;
  for(int i=0;i<N;i++){
    cin >> s[i];
  }

  int min = 1 << 29;
  for(int i=0;i<N;i++){
    if(s[i]%10 != 0 && min > s[i]){
      min = s[i];
    }
  }
  if(min == (1 << 29)){
    cout << 0 << endl;
    return 0;
  }
  
  int sum = 0;
  for(int i=0;i<N;i++){
    sum += s[i];
  }

  if(sum % 10 != 0){
    cout << sum << endl;
    return 0;
  }

  cout << sum - min << endl;

}


Measured memory_bytes: 256
function Main(input) {
    var N = parseInt(input[0], 10);
    var S = input[1].split('');

    var result = 1;

    for (var i = 1; i < N; i++) {
        if (S[i] !== S[i - 1]) {
            result++;
        }
    }

    console.log(result);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));

Measured memory_bytes: 8268
fun main(args: Array<String>) {
    val mod = 1000000007
    var (N, M) = readLongList()

    var q = 2
    val list = mutableListOf<Int>()
    val comb = Comb(200000, mod)
    var m = M

    for (q in 2..Math.sqrt(M.toDouble()).toInt()) {
        var count = 0
        while (m % q == 0) {
            m /= q
            count++
        }

        if (count != 0)
            list.add(count)
    }

    //Mが素数の場合
    if (m != 1)
        list.add(1)

    //|||||->||o|o 5C2 (n 4)
    var ans = 1L
    for (i in list) {
        ans = (ans * comb[N+i-1, i]) %mod
    }

    println(ans)
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toInt)

class Comb(val max:Int, val mod:Int) {
    val fac  = LongArray(max).apply { this[0] = 1L; this[1] = 1L }
    val finv = LongArray(max).apply { this[0] = 1L; this[1] = 1L }
    val inv  = LongArray(max).apply { this[1] = 1L }

    init {
        for (i in 2 until max) {
            fac[i] = fac[i - 1] * i % mod
            inv[i] = mod - inv[mod % i] * (mod / i) % mod
            finv[i] = finv[i - 1] * inv[i] % mod
        }
    }

    operator fun get(n:Int, k:Int):Long{
        if (n < k) return 0
        if (n < 0 || k < 0) return 0
        return fac[n] * (finv[k] * finv[n - k] % mod) % mod
    }
}

Measured memory_bytes: 40724
d,n = list(map(int,input().split()))

if d == 0:
    if n == 100:
        print(101)
    else:
        print(n)
elif d == 1:
    if n == 100:
        print(10100)
    else:
        print(100*n)

else:
    if n == 100:
        print(1010000)
    else:
        print(10000*n)

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N=int(input())
    A=list(map(int,input().split()))
    A.sort(reverse=1)
    Xor=0
    l=[-1]*60
    for x in A:
        Xor^=x
    
    Xornot=Xor^(2**(A[0].bit_length())-1)

    for i in range(N):
        A[i]&=Xornot

    for x in A:
        if l[x.bit_length()-1]==-1:
            l[x.bit_length()-1]=x

    for i in range(len(l)-1,-1,-1):
        if l[i]!=-1:
            for j in range(len(l)-1,i,-1):
                if l[j]!=-1 and (l[j]>>i)&1==1:
                    l[j]^=l[i]
    f=True
    while f:
        f=False
        for x in A:
            while x.bit_length()>1:
                if l[x.bit_length()-1]!=-1:
                    x^=l[x.bit_length()-1]
                    if l[x.bit_length()-1]==-1:
                        l[x.bit_length()-1]=x         
                        f=True
                        break
                else:
                    break
        
        for i in range(len(l)-1,-1,-1):
            if l[i]!=-1:
                for j in range(len(l)-1,i,-1):
                    if l[j]!=-1 and (l[j]>>i)&1==1:
                        l[j]^=l[i]

    tmp=0
    for i in range(len(l)-1,-1,-1):
        if l[i]!=-1 and (Xor>>i)&1==0:
            tmp^=l[i]
    
    ans=tmp+(Xor^tmp)

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 75632
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

template<class T> inline bool chmin(T& a, T b) {if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if(a<b){a=b;return true;}return false;}

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN3(a,b,s);
  Vi acc(a);
  bool exist = (s[0]=='A');
  FOR(i,1,a){
    if(exist && s[i]=='C') {
      acc[i] = acc[i-1] + 1;
      exist = false;
      continue;
    }
    if(exist) exist = false;
    if(s[i] == 'A') exist = true;
    acc[i] = acc[i-1];
  }
  REP(i,b){
    IN2(x,y);
    OUT(acc[y-1]-acc[x-1]);
  }
}

Measured memory_bytes: 1872
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long A = inputLongArray[0];
            long V = inputLongArray[1];
            inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long B = inputLongArray[0];
            long W = inputLongArray[1];
            inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long T = inputLongArray[0];

            long diff = (A <= B) ? Math.Abs(B - A) : Math.Abs(A - B);

            if(diff <= (V - W) * T)
            {
                Console.WriteLine("YES");
            }
            else
            {
                long end = (B >= 0) ? 1000000000 : -1000000000;
                long endT = Math.Abs((end - B) / W);
                endT = ((end - B) % W > 0) ? endT + 1 : endT;

                if (T < endT)
                {
                    Console.WriteLine("NO");
                }
                else if(Math.Abs((V-W)*endT)+Math.Abs(V*(T-endT))<= Math.Abs(end - A))
                {
                    Console.WriteLine("YES");
                }
                else
                {
                    Console.WriteLine("NO");
                }
            }

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 28188
// This program calculates the area and perimeter of a given rectangle
#include <iostream>
using namespace std;

int main(){

  // read the value of length and breadth
  int length, breadth;
  cin >> length >> breadth;

  // calculate and output the area and perimeter
  int area, perimeter;
  area = length*breadth;
  perimeter = 2*(length+breadth);
  cout << area << " " << perimeter << endl;

  return 0;
}

Measured memory_bytes: 3052
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
  	cin>>s;
  	int a=0,b=0;
  	for(int i=0;i<3;i++){
    	if(s.at(i)=='A'){
        	a++;
        }
      	else{
        	b++;
        }
    }
  	if(a>0&&b>0){
    	cout<<"Yes"<<endl;
    }
  	else{
    	cout<<"No"<<endl;
    }

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	long long a,b,x,m,n,s;
	cin >> a >> b >> x;
	m=a/x*x;
	n=b/x*x;
	s=(n-m)/x;
	if(a%x==0)
		s++;
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
# Divide the Problems
N = int(input())
d = list(map(int, input().split()))

d = sorted(d)

if N % 2 == 1: # 奇数個の場合は同じ数にならない
    print(0)
else:
    n = int(N / 2) #半分の数
    if d[n-1] == d[n]:
        print(0)
    else:
        ans = d[n] - d[n-1]
        print(ans)

Measured memory_bytes: 14396
N = int(input())
ans = [11, 31, 41, 61, 71, 101, 131, 151, 181, 191, 211, 241, 251, 271, 281, 311, 331, 401, 421, 431, 461, 491, 521, 541, 571, 601, 631, 641, 661,
       691, 701, 751, 761, 811, 821, 881, 911, 941, 971, 991, 1021, 1031, 1051, 1061, 1091, 1151, 1171, 1181, 1201, 1231, 1291, 1301, 1321, 1361, 1381]
print(*ans[:N])


Measured memory_bytes: 3060
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
 
#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define RS resize
#define CINV(v, N) do {\
	v.RS(N);\
	rep(i, N) cin >> v[i];\
} while (0);
#define RCINV(v, N) do {\
	v.RS(N);\
	rrep(i, N) cin >> v[i];\
} while (0);
 
#define MOD 1000000007
void init();
void solve();

signed main()
{
    init();
    solve();
}

int N;
ll W;
vector<pair<ll, ll> > vec, sor;
vector<ll> v, w;

void init()
{
    cin >> N >> W;
    v.RS(N);
    w.RS(N);
    rep(i, N) cin >> v[i] >> w[i];
    vector<pair<ll, ll> > tmp;
    int a = N / 2;
    rep(i, 1 << a) {
        ll vt = 0, wt = 0;
        int t = i;
        int pos = 0;
        while (t) {
            if (t & 1) {
                wt += w[pos];
                vt += v[pos];
            }
            pos++;
            t >>= 1;
        }
        tmp.PB(MP(wt, -vt));
    }
    sort(all(tmp));
    ll mav = -1;
    for (auto x : tmp) {
        ll vt = -x.second;
        if (vt > mav) {
           mav = vt;
           sor.PB(MP(W - x.first, -x.second));
       } 
    }
    reverse(all(sor));
    a = N - a;
    rep(i, 1 << a) {
        ll vt = 0, wt = 0;
        int t = i;
        int pos = N / 2;
        while (t) {
            if (t & 1) {
                wt += w[pos];
                vt += v[pos];
            }
            pos++;
            t >>= 1;
        }
        vec.PB(MP(wt, vt));
    }
}

void solve()
{
    ll res = -1;
    for (auto x : vec) {
        ll wt = x.first;
        ll vt = x.second;
        if (wt > W) continue;
        auto t = *lower_bound(all(sor), MP(wt, -1LL));
        res = max(res, t.second + vt);
    }
    cout << res << endl;
}




Measured memory_bytes: 43668
def get_switch(n):
    allswitch = []
    for i in range(0,2**n):
        bin_str = format(i,'0'+str(n)+'b')
        swt = list(map(int,list(bin_str)))
        allswitch.append(swt)
    return allswitch

def test(patarn,a,x,y,n):
    ans_sub=sum(patarn)
    for i in range(n):
        if patarn[i]==1:
            for j in range(a[i]):
                if y[i][j]==1:
                    if patarn[x[i][j]]==0:
                        return 0
                else:
                    if patarn[x[i][j]]==1:
                        return 0
        #else:
            #f.append(i)
            #if i in t:
                #return 0
    #print(patarn)
    return ans_sub
    
def main():
    n=int(input())
    a=[]
    x=[]
    y=[]
    for i in range(n):
        a_sub=int(input())
        a.append(a_sub)
        x_sub=[]
        y_sub=[]
        for j in range(a_sub):
            tmp=list(map(int,input().split()))
            x_sub.append(tmp[0]-1)
            y_sub.append(tmp[1])
        x.append(x_sub)
        y.append(y_sub)
    #print(x)
    #print(y)
    ans=0
    for patarn in get_switch(n):
        ans=max(ans,test(patarn,a,x,y,n))
    print(ans)

if __name__=='__main__':
    main()

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

int main()
{
  int n,t,a,H[1000],num=1;
  double f;
  cin>>n;
  cin>>t>>a;
  for(int i=0;i<n;i++) cin>>H[i];
  f=abs(a-(t-H[0]*0.006));
  for(int i=1;i<n;i++){
    if(abs(a-(t-H[i]*0.006))<f){
      f=abs(a-(t-H[i]*0.006));
      num=i+1;
    }
  }
  cout<<num<<endl;
  return 0;
}


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

int main() {
  long int N, A, ans = 0, num = 1000000007, sum = 0;
  cin >> N;
  for(int i= 0; i<N; i++){
    cin >> A;
    ans = (ans + A*sum)%num;
    sum = (sum + A)%num;  
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Edge
    {
        internal int from, to, cost;

        public Edge(int from, int to, int cost)
        {
            this.from = from;
            this.to = to;
            this.cost = cost;
        }
    }

    class Node
    {
        internal Node Parent;
        internal int Rank;
    }

    class UnionFind
    {
        private Dictionary<object, Node> _dict = new Dictionary<object, Node>();

        public void Unite(int x, int y)
        {
            var xRoot = Root(x);
            var yRoot = Root(y);
            if (xRoot == yRoot) return;

            if (xRoot.Rank < yRoot.Rank)
            {
                xRoot.Parent = yRoot;
            }
            else
            {
                yRoot.Parent = xRoot;
                if (xRoot.Rank == yRoot.Rank) xRoot.Rank++;
            }
        }

        public bool IsSameGroup(int x, int y)
        {
            return Root(x) == Root(y);
        }

        private Node Root(object data)
        {
            if (!_dict.ContainsKey(data))
            {
                var node = new Node();
                _dict.Add(data, node);
                return node;
            }
            else
            {
                var node = _dict[data];
                return Find(node);
            }
        }

        private Node Find(Node node)
        {
            if (node.Parent == null) return node;
            return node.Parent = Find(node.Parent);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int E = int.Parse(input[1]);

            List<Edge> edges = new List<Edge>();

            for (int i = 0; i < E; i++)
            {
                input = Console.ReadLine().Split(' ');
                int s = int.Parse(input[0]);
                int t = int.Parse(input[1]);
                int w = int.Parse(input[2]);
                edges.Add(new Edge(s, t, w));
            }

            Console.WriteLine(Kruskal(edges));
        }

        static int Kruskal(List<Edge> edges)
        {
            edges.Sort((a, b) => a.cost - b.cost);
            UnionFind UF = new UnionFind();

            int totalCost = 0;
            int len = edges.Count;

            for (int i = 0; i < len; i++)
            {
                Edge e = edges[i];

                if (!UF.IsSameGroup(e.from, e.to))
                {
                    UF.Unite(e.from, e.to);
                    totalCost += e.cost;
                }
            }
            return totalCost;
        }
    }
}

Measured memory_bytes: 17632
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n = sc.nextInt();
        int m = sc.nextInt();
        int a[]=sc.nextIntArray(n);
        int b[]=sc.nextIntArray(m);
        long dp[][] = new long[n+1][m+1];
        fill(dp[0],1);
        for (int i = 1; i <= n; i++) {
        	dp[i][0]=1;
        }
        
        for (int i = 1; i <= n; i++) {
			for (int t = 1; t <= m ; t++) {
				dp[i][t] = dp[i][t-1] + dp[i-1][t]%mod - dp[i-1][t-1];
				dp[i][t]%=mod;
				if(a[i-1]==b[t-1])dp[i][t]+=dp[i-1][t-1];
				dp[i][t]%=mod;
				if(dp[i][t]<0)dp[i][t]+=mod;
//				db(i,t,dp[i][t]);
			}
		}
        
        out.println(dp[n][m]);
        out.flush();
    }

    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}
//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//    int a,b;
//    double c;
//    P(int a, int b) {
//    	this.b=b;
//    	this.a=a;
//    	this.c=(double)b/a;
//    }
//
//    public int compareTo(P p){
//        return Double.compare(p.c,c);
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) throws IOException{
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 82716
from collections import defaultdict
from itertools import permutations
import heapq

INF = float('inf')
N, M, R = map(int, input().split())
r = list(map(int, input().split()))

Adj_list = defaultdict(set)

for i in range(M):
    a, b, c = map(int, input().split())   
    Adj_list[a-1].add((b-1, c))
    Adj_list[b-1].add((a-1, c))


def dijkstra(x, vertex):
    d = [INF] * x
    d[vertex] = 0
    hq = [(0, vertex)]
    
    while hq:
        u = heapq.heappop(hq)[1]
        for (v, c) in Adj_list[u]:
            if d[v] > d[u] + c:
                d[v] = d[u] + c
                heapq.heappush(hq, (d[u]+c, v))

    return d

ans = INF
t_dis = 0

table = {}
for i in r:
    table[i-1] = dijkstra(N, i-1)

for each in permutations(r):
    t_dis = 0
    for i in range(R-1):
        t_dis += table[each[i]-1][each[i+1]-1]

    ans = min(ans, t_dis)

print(ans)

Measured memory_bytes: 8440
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(n * a, b) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repX(i, n ,x) for (ll i = x; i < (ll)(n); ++i)
#define repBack(i, n) for (ll i = n; i >= 0; --i)
#define dup(x,y) (((x)+(y)-1)/(y))

int main() {
    ll N;
    cin >> N;
    vector<long long> div;
    for (long long i = 1; i * i <= N; i++)
    {
        if (N % i == 0)
        {
            div.push_back(i);
            if (i * i != N)
                div.push_back(N / i);
        }
    }
    ll ans = 1001001001001001001;
    rep(i,div.size()){
        repX(j,div.size(),i){
            if(div[i]*div[j]!=N)continue;
            ans = min(ans,div[i]-1+div[j]-1);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

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

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    long[] a = sc.nextLongArray(n);
    long mod = 1000000007L;
    long result = 0L;
    long[] sum = new long[n + 1];
    for (int i = 0; i < n; i++) {
      sum[i + 1] = sum[i] + a[i];
      sum[i + 1] %= mod;
    }
    for (int i = 0; i < n; i++) {
      long m = sum[n] - sum[i + 1];
      if (m < 0) m += mod;
      long add = (a[i] * m) % mod;
      result += add;
      result %= mod;
    }
    System.out.println(result);
  }
}

Measured memory_bytes: 55672
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const ll mod=1e9+7;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    if(n%2==1){
        cout<<0<<endl;
        return 0;
    }

    ll ans = 0;
    for (ll i = 5; n / i >= 1; i *= 5){
        ll k= n / i;
        ans+=(k/2);
}
    cout<<ans<<endl;

    return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
//もう二度とつかわん//
//    ↓ ↓　↓　　 //
#define ll long long
//    ↑　↑　↑    //
//フェルマー方程式の恨み//
#define rep(i,n) for(int i=0;i<n;i++)
#define ggr getchar(); getchar();return 0;
using namespace std;
signed main() {
	ll n, a, b, c, d, e;
	cin >> n >> a >> b >> c >> d >> e;
	if (n % a != 0)a = n / a + 1;
	else a = n / a;
	if (n % b != 0)b = n / b + 1;
	else b = n / b;
	if (n % c != 0)c = n / c + 1;
	else c = n / c;
	if (n % d != 0)d = n / d + 1;
	else d = n / d;
	if (n % e != 0)e = n / e + 1;
	else e = n / e;
	cout << 5 + max({ a,b,c,d,e }) - 1 << endl;
	ggr
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int len,i,ok=0;
	string s;
	cin>>s;
	len=s.size()-1;
	for(i=0;i<=len;i++)
	{
		if(ok==0&&s[i]=='C')
		ok=1;
		if(ok==1&&s[i]=='F')
		ok=2;
		if(ok==2)
		break;
	}
	if(ok==2)
	cout<<"Yes";
	else
	cout<<"No";
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

llong gyaku(llong num, llong now){
	if(now == 1)
		return num;

	llong ret = gyaku(num, now/2);
	((ret %= mod) *= ret) %= mod;
	return ret * (now%2 ? num : 1) % mod;
}

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

	vector<llong> nCr(H+W+1,1), nCr_r(H+W+1,1);
	for(int i = 1; i <= H+W; i++){
		nCr[i] = nCr[i-1] * i % mod;
		nCr_r[i] = nCr_r[i-1] * gyaku(i, mod-2) % mod;
	}

	llong ans = 0;
	for(int i = B+1; i <= W; i++){
		llong fst = nCr[H-A-1 + i-1] * nCr_r[H-A-1] % mod * nCr_r[i-1] % mod;
		llong snd = nCr[A-1 + W-i] * nCr_r[A-1] % mod * nCr_r[W-i] % mod;
		(ans += fst*snd) %= mod;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3328
H, W = map(int, input().split())
a = [[int(i) for i in input().split()] for _ in range(H)]
ans = []
for y in range(H):
    for x in range(W):
        if a[y][x] % 2 == 1:
            if y == H-1 and x == W-1:
                break
            if y < H-1:
                a[y][x] -= 1
                a[y+1][x] += 1
                ans.append((y+1, x+1, y+2, x+1))
            else:
                a[y][x] -= 1
                a[y][x+1] += 1
                ans.append((y+1, x+1, y+1, x+2))

print(len(ans))
for t in ans:
    print(*t)


Measured memory_bytes: 73948
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<string, string>;
ll MOD = 1e9+7;
int main()
{
    int n, m;
    string s;
    cin >> n >> m >> s;
    vector<set<int>> d(n);
    for(int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        a--;b--;
        d[a].insert(b);
        d[b].insert(a);
    }
    set<int> remove;
    vector<int> ca(n);
    vector<int> cb(n);
    for(int i = 0; i < n; i++)
    {
        for(int next : d[i])
        {
            if(s[next] == 'A') ca[i]++;
            else cb[i]++;
        }
        if(ca[i] == 0 || cb[i] == 0) remove.insert(i);
    }
    int ans = n;
    while(remove.size())
    {
        int cand = *remove.begin();
        remove.erase(cand);
        ans--;
        for(int next : d[cand])
        {
            if(next == cand) continue;
            d[next].erase(cand);
            if(s[cand] == 'A') ca[next]--;
            else cb[next]--;
            if(ca[next] == 0 || cb[next] == 0)
            {
                remove.insert(next);
            }
        }
    }
    if(ans > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}



Measured memory_bytes: 33924
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
from itertools import product
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N, M = map(int, readline().split())
    S = []
    for _ in range(M):
        k, *s = map(int, readline().split())
        S.append(s)
    P = list(map(int, readline().split()))
    ans = 0

    for switch in product((0,1),repeat=N):
        for i, s in enumerate(S):
            tmp = 0
            for k in s:
                tmp ^= switch[k-1]
            if tmp==P[i]:
                continue
            else:
                break
        else:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()



Measured memory_bytes: 9088
import java.io.*;
import java.util.StringTokenizer;
import java.util.Arrays;

class Main{

static final PrintWriter out=new PrintWriter(System.out);

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st=new StringTokenizer(line);
int n=Integer.parseInt(st.nextToken());
int m=Integer.parseInt(st.nextToken());
int[] cost=new int[n];
int[] vote1=new int[n];
for(int i=0;i<n;i++) cost[i]=Integer.parseInt(br.readLine());
for(int i=0;i<m;i++){
int judge=Integer.parseInt(br.readLine());
for(int j=0;j<n;j++){
if(cost[j]>judge) continue;
vote1[j]++;
break;
}
}
int[] vote2=vote1.clone();
Arrays.sort(vote2);
int max=vote2[n-1];
for(int i=0;i<n;i++){
if(vote1[i]==max){
out.println(i+1);
break;
}
}
out.flush();
}
}
}

Measured memory_bytes: 19792
#include<iostream>

using namespace std;

int W, H, N;

int main() {
    cin >> W >> H >> N;
    int x0 = 0, x1 = W, y0 = 0, y1 = H;
    int x, y, a;
    for (int i = 0; i < N; i++) {
        cin >> x >> y >> a;
        if(a==1) x0 = max(x, x0);
        if(a==2) x1 = min(x, x1);
        if(a==3) y0 = max(y, y0);
        if(a==4) y1 = min(y, y1);
    }
    cout << max(x1 - x0, 0) * max(y1 - y0, 0) << endl;   
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std; 
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long int
#define rep(i,a,b) for(int i=a;i<b;i++)
#define reprev(i,a,b) for(int i=b-1;i>=a;i--)
#define all(c) c.begin(),c.end()
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define vin(a,n) vi a(n); rep(i,0,n) cin>>a[i];
#define vout(a) rep(i,0,a.size()) cout<<a[i]<<" "; cout<<endl;
#define mapp map<int,int>
#define pb push_back
#define mp  make_pair
#define mod 1000000007
#define mod2 998244353
#define inf LLONG_MAX
#define pi 3.1415926535897932384626
#define tr(container, it) \
for(auto it = container.begin(); it != container.end(); it++)

bool comps(const pair<int,int> &a, const pair<int,int> &b) {return (a.second<b.second);} 

int power(int x, unsigned int y)
{ 
    int temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2); 
    if (y%2 == 0) 
        return temp*temp; 
    else
        return x*temp*temp; 
}

int powerp(int x, unsigned int y, int p)  
{  
    int res = 1;     // Initialize result  
  
    x = x % p; // Update x if it is more than or  
                // equal to p 
   
    if (x == 0) return 0; // In case x is divisible by p; 
  
    while (y > 0)  
    {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}
mapp m;
void primeFactors(int n)  
{  
    // Print the number of 2s that divide n  
    while (n % 2 == 0)  
    {  
        m[2]++;  
        n = n/2;  
    }  
  
    // n must be odd at this point. So we can skip  
    // one element (Note i = i +2)  
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        // While i divides n, print i and divide n  
        while (n % i == 0)  
        {  
            m[i]++;  
            n = n/i;  
        }  
    }  
  
    // This condition is to handle the case when n  
    // is a prime number greater than 2  
    if (n > 2)  
        m[n]++;
}

signed main()
{
    IOS
    int n;
    cin>>n;
    if(n==1) {cout<<0; return 0;}
    primeFactors(n);
    int ans=0;
    tr(m,it)
    {
        int i;
        for(i=1;i<70;i++)
        {
            if((i+1)*(i+2)/2>it->ss) break;
        }
        ans+=i;
    }
    cout<<ans;
    return 0;
}

// vector<vector<int>> adj;
// vector<bool> visited;
// void dfs(int v) 
// {
//     visited[v] = true;
//     for (int u : adj[v]) 
//     {
//         if (!visited[u])
//         {
//             dist[u].ff=dist[v].ff+1;
//             dist[u].ss=u;
//             dfs(u);
//         }
//     }
// }
// int binarySearch(int l, int r) 
// { 
//     while (l <= r) { 
//         int m = l + (r - l) / 2; 
  
//         //ignore left half 
//         if (!check(m)) 
//             l = m + 1; 
  
//         //ignore right half 
//         else
//             r = m - 1; 
//     }   
//     return l;
// }

Measured memory_bytes: 3696
#include<iostream>
using namespace std;
int kazu[100],n;
int com(){
cin>>n;
for(int a=0;a<n;a++)
cin>>kazu[a];
for(int b=n-1;b>=0;b--){
cout<<kazu[b];
if(b!=0)
cout<<" ";
else
cout<<endl;
}
}
int main(){
com();
return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>

#define ll long long
#define vl vector<ll>
#define vvl vector< vector<ll> >
#define vb vector<bool>
#define vbb vector< vector<bool> >
#define vs vector<string>

#define all(a) (a).begin(),(a).end()
using namespace std;

bool check(vs &ngo, string s){
	for (string t : ngo) if (t == s) return 0;
	return 1;
}

int main(){
	vl p1(2), p2(2); cin >> p1[0] >> p1[1] >> p2[0] >> p2[1];
	ll san = p2[0] - p1[0];
	ll maru = p2[1] - p1[1];
	cout << p2[0] - maru << " " << p2[1] + san << " " << p1[0] - maru << " " << p1[1] + san << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N,K,Q;
  cin >> N >> K >> Q;
vector<int> A(Q);
  vector<int> B(N);
  for(int a = 0;a < Q;a++)cin >> A.at(a);
  for(int a = 0;a < N;a++)B.at(a) = Q - K;
  for(int a = 0;a < Q;a++){
    B.at(A.at(a) - 1) -= 1;
  }
  for(int a = 0;a < N;a++){
    if(B.at(a) < 0){
    cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
    
  }
}

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

using namespace std;

int main(void){

    string str[3];

    for(int i = 0;i < 3;i++){
        cin >> str[i];
    }

    for(int i = 0;i < 3;i++){
        cout << str[i][i];
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cstdlib>

using namespace std;

int main(){
  int n,l;
  cin>>n>>l;
  vector<string> s(n);
  //vector<vector<string> > s(n,vector<string>(l));
  for(int i=0;i<n;i++){
    cin>>s.at(i);
    //cout<<s.at(i).at(0)<<endl;

  }
  sort(s.begin(),s.end());
  for(int i=0;i<n;i++){
    cout<<s.at(i);
  }
  cout<<endl;



return 0;
  }


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

typedef struct {
    int x;
    int y;
    int num;
} Equation;

void rounding(double num);

int main(void) {
    Equation a, b;
    double x, y;
    
    while(scanf("%d %d %d %d %d %d", &a.x, &a.y, &a.num, &b.x, &b.y, &b.num) != EOF) {
        y = (double)((b.x * a.num) - (a.x * b.num)) / ((b.x * a.y) - (a.x * b.y));
        x = (double)(a.num - (a.y * y)) / a.x;
        
        rounding(x);
        rounding(y);
        
        printf("%.3f %.3f\n", x, y);
    }
    
    return(0);
}

void rounding(double num) {
    num *= 1000;
    num += 0.5;
    num = floor(num);
    num /= 1000;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, k;
  cin >> a >> b >> k;
  set<int> s;
  for(int i=0; i<k; i++){
    if(a + i <= b){
      cout << a + i << endl;
      s.insert(a + i);
    }
  }
  for(int i=0; i<k; i++){
    if(s.count(b - k + 1 + i)) continue;
    else{
      if(b - k + 1 + i <= b && b - k + 1 + i >= a){
        cout << b - k + 1 + i << endl;
      }
    } 
  }
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#include <tr1/unordered_map>
using namespace std;
typedef long long LL;
typedef __int128 IL;
typedef map <LL,LL> Map;
typedef Map :: iterator it_m;

const int RLEN=1<<18|1; const LL mod=998244353998244353LL;
inline char nc() {
    static char ibuf[RLEN],*ib,*ob;
    (ib==ob) && (ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
    return (ib==ob) ? -1 : *ib++;
} 
inline LL rd() {
    char ch=nc(); LL i=0,f=1;
    while(!isdigit(ch)) {if(ch=='-')f=-1; ch=nc();}
    while(isdigit(ch)) {i=(i<<1)+(i<<3)+ch-'0'; ch=nc();}
    return i*f;
}
inline LL mul(LL a,LL b,LL md) {return (IL)a*b%md;}
inline LL power(LL a,LL b,LL md,LL rs=1) {for(;b;b>>=1,a=mul(a,a,md)) if(b&1) rs=mul(rs,a,md); return rs;}

Map s1,s2; int bz=0;
namespace RHO {
    const int pr[]={2,3,5,7,11,13,17,19,23};
    vector <LL> vec;
    inline LL gcd(LL a,LL b) {return b ? gcd(b,a%b) : a;}
    inline LL rho(LL nn,LL c) {
        LL x=rand()%nn+1, y=x, k=2;
        for(int i=1;;i++) {
            x=(mul(x,x,nn)+c)%nn;
            LL p=gcd(abs(y-x),nn);
            if(p!=1) return p;
            if(i==k) k<<=1, y=x;
        }
    }
    inline bool mr(LL nn) {
        if(nn<=3) return true;
        if((nn%6)!=1 && (nn%6)!=5) return false;
        LL s1=nn-1, s2=0;
        while(!(s1&1)) s1>>=1, ++s2;
        for(int i=0;i<=8;i++) {
            if(nn==pr[i]) return true;
            LL p=power(pr[i],s1,nn);
            for(int j=1;j<=s2 && p!=1;++j) {
                LL t=mul(p,p,nn);
                if(t==1 && p!=nn-1 && p!=1) return false;
                p=t;
            }
            if(p!=1) return false;
        } return true;
    }
    inline void solve(LL nn) {
        if(mr(nn)) {vec.push_back(nn%mod); return;}
        LL g=rho(nn,rand()%nn); 
        while(g==nn) g=rho(nn,rand()%nn);
        solve(nn/g); solve(g);
    }
    inline void fac(LL nn) {
        if(nn==1) return (void)(bz++);
        vec.clear();
        solve(nn);
        sort(vec.begin(),vec.end());
        LL a1=1, a2=1;
        for(int i=0,lst=0;i<vec.size();++i) {
            ++lst;
            if(i!=vec.size()-1 && vec[i+1]==vec[i]) continue;
            lst%=3;
            if(lst) a1=mul(a1,power(vec[i]%mod,lst,mod),mod), a2=mul(a2,power(vec[i]%mod,3-lst,mod),mod);
            lst=0;
        } 
        if(a1==1) return (void)(bz++);
        s2[a1]=a2; s2[a2]=a1; ++s1[a1];
    }
}

int main() {
    int n=rd();  srand(time(0));
    for(int i=1;i<=n;i++) RHO::fac(rd());
    int ans=0;
    for(it_m it=s1.begin();it!=s1.end();++it) 
        if((it->second)>s1[s2[it->first]] || ((it->second)==s1[s2[it->first]] && it->first>=s2[it->first])) ans+=it->second;
    cout<<ans+(bz>0)<<'\n'; 
} 

Measured memory_bytes: 25472
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        byte n = scan.nextByte();
        if(65 <= n && n <= 90){
            System.out.println(1);
        }else if(97 <= n && n <= 122){
            System.out.println(2);
        }else{
            System.out.println(0);
        }
        scan.close();
    }
}


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

using namespace std;

int main() {
  int N;
  cin>>N;
  int d[N];
  for(int i=0; i<N; i++) {
    cin>>d[i];
  }

  int sum = 0;
  for(int i=1; i<=N; i++) {
    for(int j=1; j<=N; j++) {
      if(i<j) {
        sum += d[i-1] * d[j-1];
      } 
    }
  }
  
  cout<<sum<<endl;
}


Measured memory_bytes: 256
using static System.Console;
using static System.Convert;

class Program
{
    static void Main(string[] args)
    {
        var input = ReadLine().Split(' ');
        var kind = ToInt32(input[0]);
        var num = ToInt32(input[1]);
        var min = int.MaxValue;
        for(var i = 0; i < kind; i++)
        {
            var qu = ToInt32(ReadLine());
            num -= qu;
            if (min > qu) min = qu;
        }
        WriteLine(kind + num / min);
    }
}



Measured memory_bytes: 13396