akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n); for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main(){
    int N;
    int A[1100];
    cin >> N;
    rep(i,N) cin >> A[i];

    bool isapproved = true;
    rep(i,N){
        if( A[i]%2 == 0){
            if( (A[i]%3 != 0)&&(A[i]%5 != 0)){
                isapproved = false;
                break;
            }
        }
    }
    if(isapproved) printf("APPROVED");
    else printf("DENIED");
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>

using namespace std;

int N,M,A[1000],i,j,k;

double R;

int main()
{
cin>> i;

R=i*2.*3.141592;

cout <<R;








}

Measured memory_bytes: 3788
import java.util.Scanner;

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

		int h = sc.nextInt();
		int w = sc.nextInt();

		int cnt = 0;
		for (int i = 0; i < h; i++) {
			cnt += sc.next().replace(".", "").length();
		}

		String ans = cnt == h + w - 1 ? "Possible" : "Impossible";
		System.out.println(ans);
		sc.close();
	}

}


Measured memory_bytes: 23892
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (H, W, A, B): (i64, i64, i64, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };

    // 以下の形で構築すればよい
    // 0..01..1
    // ..
    // 0..01..1
    // 1..10..0
    // ..
    // 1..10..0
    let ans = (0..H).map(|i| if i < B {
        (0..W).map(|j| if j < A { '0' } else { '1' }).collect::<String>()
    } else {
        (0..W).map(|j| if j < A { '1' } else { '0' }).collect::<String>()
    })
    .collect::<Vec<_>>()
    .join("\n");

    println!("{}", ans);
}

Measured memory_bytes: 7292
#include<iostream>
using namespace std;
 
int main(){
  long long int a, b, k;
  cin >> a >> b >> k;
  if(a >= k){
    cout << a - k << " " << b << endl;
  }
  else{
    if(b - k + a > 0)cout << 0 << " " << b - k + a;
    else cout << 0 << " " << 0;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long int N, C[500] = {}, S[500] = {}, F[500] = {}, Time = 0;

int main() {
	cin >> N;
	for (int i = 1; i <= N - 1; i++)cin >> C[i] >> S[i] >> F[i];
	for (int i = 1; i <= N - 1; i++) {
		Time = 0;
		for (int j = i; j <= N - 1; j++) {
			if (Time <= S[j]) {
				Time = S[j] + C[j];
			}
			else if (Time%F[j] == 0) {
				Time += C[j];
			}
			else {
				Time = Time + F[j] - Time%F[j] + C[j];
			}
		}
		cout << Time << endl;
	}
	cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>
using namespace std;

#define ll long long
#define mst(a) memset(a, 0, sizeof a)

const int mod = 1e9+7;
const int maxn = 2e5+50;
const int inf = 1e9;

int a[maxn];
vector<int> neg;
vector<int> pos;

int main()
{
    int n, k;
    scanf("%d %d", &n, &k);
    for (int i = 0; i < n; ++i)
    {
        scanf("%d", a + i);
        if (a[i] > 0) pos.push_back(a[i]);
        else if (a[i] < 0) neg.push_back(-a[i]);
    }
    int m1 = pos.size();
    int m2 = neg.size();
    int cnt0 = n - m1 - m2;
    sort(neg.begin(), neg.end());
    sort(pos.begin(), pos.end());
    for (int i = 0; i < m1/2; ++i)
        swap(pos[i], pos[m1-i-1]);
    for (int i = 0; i < m2/2; ++i)
        swap(neg[i], neg[m2-i-1]);
    long long res = 1;
    if (m1 + m2/2*2 >= k)
    {
        if (k % 2 == 1 && m1 == 0)
        {
            if (n != m1 + m2) res = 0;
            for (int i = m2-1; i >= m2-k; --i)
                res = (res * -neg[i] % mod + mod) % mod;
            //res = (mod - res) % mod;
        }
        else
        {
            int p2 = min(k - (k&1), m2/2*2) - 1;
            int p1 = k - (p2 + 1);
            int maxp = p1;
            while (p1 + 1 < m1 && p2 >= 0)
            {
                long long t1 = (long long)pos[p1] * pos[p1+1];
                long long t2 = (long long)neg[p2] * neg[p2-1];
                if (t1 > t2) maxp = p1 + 2;
                p1 += 2;
                p2 -= 2;
            }
            for (int i = 0; i < maxp; ++i)
                res = res * pos[i] % mod;
            for (int i = 0; i < k - maxp; ++i)
                res = res * neg[i] % mod;    
        }
    }
    else
    {
        if (n != m1 + m2) res = 0;
        else
        {
            for (int i = 0; i < n; ++i)
                res = (res * a[i] % mod + mod) % mod;
        }
    }
    printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 5192
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bug1( x ) {cerr << (#x) <<"="<< x << endl;}
#define bug2( x , y ) {cerr << (#x) <<"="<< (x) << "    " << (#y) << "="<< (y) << endl;}
#define bug3( x , y , z ) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << endl;}
#define bug4( x , y , z , w) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << endl;}
#define bug5( x , y , z , w ,p) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << endl;}
#define bug6( x , y , z , w ,p , q) {cerr << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << "    " << (#p) <<"="<< p << "    " << (#q) <<"="<< q << endl;}
#define bugn( x , n ) {cerr << (#x) <<":";for(int i=0;i<n;i++)cerr << x[i] <<"  "; cerr << endl;}
#define bugnm( x , n , m ) {cerr << (#x)<<endl;for(int i=0;i<n;i++){cerr << "Row #" << i<< ":";for(int j=0;j<m;j++)cerr << x[i][j] << "   ";cerr << endl;}}
typedef long long ll;
typedef long double ld;
using namespace std;

// alive edges :  path 1->n through this edge
// we have to consider only those
// because we can get lost in negative cycle of non alive edges.

const int maxn = 2500+5, maxm = 5000+5;
vector<vector<pair<int,int>>> g(maxn), gr(maxn);
vector<int>U(maxm),V(maxm),W(maxm),alive(maxm);
int n,m,p,neg_cycle=0;

vector<int> reachable(int s,vector<vector<pair<int,int>>>&g){
	vector<int>vis(n+1);
	queue<int>q;
	q.push(s);
	vis[s]=1;
	while( q.size() ){
		int u = q.front(); q.pop();
		for(auto [v,i]:g[u]){
			if( !vis[v] ){
				vis[v]=1;
				q.push(v);
			}
		}
	}
	return vis;
}

vector<int> spfa(int s,vector<vector<pair<int,int>>>&g){
	vector<int>dis(n+1,1e18);
	vector<int>inq(n+1);
	vector<int>cnt(n+1);
	queue<int>q;
	dis[s]=0;
	q.push(s);
	inq[s]=1;
	while( q.size() ){
		int u = q.front(); q.pop(); inq[u] = 0;
		for(auto [v,i]:g[u]){
			if( !alive[i] )continue;
			if( dis[v] > dis[u] - W[i] + p ){
				dis[v] = dis[u] - W[i] + p;
				cnt[v] += 1;
				if( cnt[v] > n+m ){
					neg_cycle = 1;
					return dis;
				}
				if( !inq[v] ){
					inq[v] = 1;
					q.push(v);
				}
			}
		}
	}
	return dis;
	
}


int32_t main(){
	IOS
	cin >> n >> m >> p;
	for(int i=1;i<=m;i++){
		cin >> U[i] >> V[i] >> W[i];
		g[U[i]].push_back({V[i],i});
		gr[V[i]].push_back({U[i],i});
	}
	vector<int>vis1 = reachable(1,g);
	vector<int>visn = reachable(n,gr);
	for(int i=1;i<=m;i++){
		alive[i] =  vis1[ U[i] ] && visn[ V[i] ];
	}
	vector<int> dis = spfa(1,g);
	if( neg_cycle ){
		cout << -1 << endl;
		return 0;
	}
	int ans =  max(-dis[n],0ll);
	cout << ans << endl;
	
	
}
/*
 * long long or int?
 * index out of bound?
 * Tested on own test case?corner?
 * Make more general solution.
 * Read Read Read Read ....
 */


Measured memory_bytes: 4276
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	static List<Long> list = new ArrayList<>();

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		sc.close();

		for (int i = 1; i <= 9; i++) {
			dfs(i);
		}
		Collections.sort(list);
		System.out.println(list.get(k - 1));
	}

	static void dfs(long x) {
		if (x > 3234566667L) {
			return;
		}
		list.add(x);
		if (x % 10 > 0) {
			dfs(x * 10 + x % 10 - 1);
		}
		dfs(x * 10 + x % 10);
		if (x % 10 < 9) {
			dfs(x * 10 + x % 10 + 1);
		}
	}
}


Measured memory_bytes: 28372
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var set = new HashSet<int>();
            var col = new int[] { 400, 800, 1200, 1600, 2000, 2400, 2800, 3200 };
            var cnt = 0;
            for (int i = 0; i < N; ++i)
            {
                var a = cin.ReadInt;
                for (int j = 0; j < 8; ++j)
                {
                    if (a < col[j])
                    {
                        set.Add(j);
                        break;
                    }
                }
                if (a >= 3200) cnt++;
            }

            var min = Max(set.Count(), 1);
            var max = set.Count() + cnt;
            WriteLine($"{min} {max}");
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
        public void ReadIntArrays(long N, out int[] A, out int[] B) { A = new int[N]; B = new int[N]; for (long i = 0; i < N; ++i) { A[i] = ReadInt; B[i] = ReadInt; }}
        public void ReadLongArrays(long N, out long[] A, out long[] B) { A = new long[N]; B = new long[N]; for (long i = 0; i < N; ++i) { A[i] = ReadLong; B[i] = ReadLong; }}
    }
}


Measured memory_bytes: 13524
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
using namespace std;

int main (void){
	long long int n,t,a,i,h[100001],d[100001],e[100001];
	cin >> n >> t >> a;
	for(i=0;i<n;i++) {
		cin >> h[i];
		d[i]=abs(t*1000-6*h[i]-a*1000);
		e[i]=d[i];
	}
	sort(d,d+n);
	for(i=0;i<n;i++){
		if(e[i]==d[0]) cout << i+1 << endl;
	}
	return 0;
}

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

#define fast ios_base::sync_with_stdio(false); cin.tie(nullptr); cin.tie(nullptr);
#define int long long
#define ld long double
#define pb emplace_back
#define range(v) v.begin(),v.end()
#define mod (int)(1e9 + 7)
#define inf (int)(1e15)
#define pii pair<int,int>
#define ff first
#define ss second
// #define N (int)()

using namespace std;

int val(int cnt, vector<int> &pre) {
    int ans;
    int l = 1, r = 100000;

    while (l <= r) {
        int mid = l + (r - l) / 2;
        if (pre[mid] <= cnt) {
            ans = mid;
            l = mid + 1;
        } else r = mid - 1;
    }

    return ans;
}

int32_t main() {
    fast
    int t_c = 1;
//	cin >> t_c;
    while (t_c--) {


        int n, c;
        cin >> n;
        vector<pii > v;
        c = n;
        for (int i = 2; i * i <= n; i++) {
            if (c % i == 0) {
                int cnt = 0;
                while (c % i == 0) {
                    c /= i;
                    cnt++;
                }
                v.pb(i, cnt);
            }
        }
        if (c != 1) v.pb(c, 1);

        vector<int> pre(100000);
        for (int i = 1; i < 100000; i++)
            pre[i] = pre[i - 1] + i;
        int cnt = 0;
        for (pii &p : v) {
            cnt += val(p.ss, pre);
        }

        cout << cnt << endl;


    }
}

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

int main() {

int n;
cin>>n;
vector<int> dame(1e6+1);
vector<int> vec(n);
rep(i,n)cin>>vec[i];
int ans=0;
sort(vec.begin(),vec.end());
vector<int>counter(1e6+1);
//同じ数2つある場合の処理考える
rep(i,n)
{int num=vec[i];
 if(counter[num]==1)counter[num]++;
 if(dame[num]!=0)continue;
 counter[num]=1;
 ans++;
 for(int j=1; num*j<=1e6; ++j)dame[num*j]++;
}

rep(i,1e6+1)
{
  if(counter[i]>=2)ans--;
}

cout <<ans<<endl;




}
/*vector <int> a(3);
for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }*/

Measured memory_bytes: 11976
import sys


def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n % i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table


def main():
    a, b = input().split()
    ab = int(a+b)
    ab_divisor = divisor(ab)
    ab_divisor.remove(1)
    for div in ab_divisor:
        if ab / div == div:
            print('Yes')
            sys.exit(0)

    print('No')


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <stdlib.h>
#include <assert.h>
#include <iostream>
#include <algorithm>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <complex>
#include <iomanip>
#include <bitset>
#include <random>
#include <vector>
#include<string>
#include <limits.h>

using namespace std;


int main() {
	int n, i, j, c[555], flag[555], flag2 =0,ans,flag3,min=555,k;
	char a[555][555];
	cin >> n;
	ans = n;
	for (i = 0; i < n; i++)
		cin >> a[i];
	for (i = 0; i < n; i++) {
		c[i] = 0;
		flag[i] = 0;
	}
	for (j = 0; j < n; j++) {
		flag3 = 1;
		for (i = 0; i < n; i++) {
			if (a[i][j] == '#') {
				c[i]++;
				flag[j] = 1;
				flag2 = 1;
			}
			else
				flag3 = 0;
		}
		if (flag3 == 1)
			ans--;
	}
	if (flag2 == 0) {
		cout << "-1" << endl;
		return 0;
	}
	for (i = 0; i < n; i++) {
		k = n - c[i];
		if (flag[i] == 0)
			k++;
		if (k < min)
			min = k;
	}
	ans += min;
	cout << ans << endl;
}


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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> vec(n + 1);
  for (auto &v : vec)
    cin >> v;

  long long money = 1000;
  for (int i = 1; i < n; ++i)
    if (0 < vec[i] - vec[i - 1])
      money += money / vec[i-1] * (vec[i] - vec[i-1]);
  cout << money << endl;
}


Measured memory_bytes: 3604
void main() {
    string[dchar] s;
    s['a'] = readln.chomp;
    s['b'] = readln.chomp;
    s['c'] = readln.chomp;
    dchar now = 'a';
    dchar ans;
    while (true) {
        dchar tmp = s[now][0];
        s[now] = s[now][1..$];
        now = tmp;
        if (s[now].length == 0) {
            ans = tmp;
            break;
        }
    }
    ans.toUpper.writeln;
}

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

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <map>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long Int;

int main() {
    for (;;) {
        int n;
        scanf("%d", &n);
        if (n == 0) return 0;
        vector<vector<int> > a(n+1, vector<int>(n+1, 0));
        rep (i, n) rep (j, n) scanf("%d", &a[i][j]);
        rep (i, n) rep (j, n) a[n][i] += a[j][i];
        rep (i, n+1) rep (j, n) a[i][n] += a[i][j];
        rep (i, n+1) {
            rep (j, n+1) printf("%5d", a[i][j]);
            printf("\n");
        }
    }
    return 0;
}

Measured memory_bytes: 0
import sys
readline = sys.stdin.readline

S = readline().rstrip()
T = readline().rstrip()

# dp[i][j] = Sをi文字目、Tをj文字目まで進めたときの最長
# S[i] == S[j]のとき
# dp[i][j] = dp[i - 1][j - 1] + 1
# S[i] != S[j]のとき
# dp[i][j] = max(dp[i - 1][j],dp[i][j - 1])

# その際、自分がどこから来たか？を記録する
# dp[i - 1][j] > dp[i][j - 1]であれば
# route[i][j] = (i,j)を記録

dp = [[0] * (len(T) + 1) for i in range(len(S) + 1)]
route = [[(0,0)] * (len(T) + 1) for i in range(len(S) + 1)]

for i in range(len(S)):
  for j in range(len(T)):
    if S[i] == T[j]:
      dp[i + 1][j + 1] = dp[i][j] + 1
      route[i + 1][j + 1] = (i,j)
    else:
      if dp[i][j + 1] > dp[i + 1][j]:
        dp[i + 1][j + 1] = dp[i][j + 1]
        route[i + 1][j + 1] = (i,j + 1)
      else:
        dp[i + 1][j + 1] = dp[i + 1][j]
        route[i + 1][j + 1] = (i + 1,j)

# routeのとびさきの文字を追加していく
x,y = len(S),len(T)
ans = ""
while x != 0 and y != 0:
  if S[x - 1] == T[y - 1]:
    ans += S[x - 1]
  x,y = route[x][y]

print(ans[::-1])

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int A[100010];
pair<int, int> B[100010];

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N, M;
	cin >> N >> M;
	rep(i, 0, N)
	{
		cin >> A[i];
	}
	sort(A, A + N);

	rep(i, 0, M)
	{
		cin >> B[i].second >> B[i].first;
	}

	sort(B, B + M, greater<pair<int,int>>());

	int ti = 0;
	rep(i, 0, M)
	{
		rep(j, 0, B[i].second)
		{
			if (ti < N&&A[ti] < B[i].first)
			{
				A[ti] = B[i].first;
				ti++;
			}
			else
			{
				break;
			}
		}
	}

	int ans = 0;
	rep(i, 0, N)
	{
		ans += A[i];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2560
N,A,B = map(int,input().split())
passed = 0
passedB = 0
for i in input():
    if i == "a":
        if passed < A + B:
            print("Yes")
            passed += 1
        else:
            print("No")
    elif i == "b":
        if passed < A + B and passedB < B:
            print("Yes")
            passed += 1
            passedB += 1
        else:
            print("No")
    else:
        print("No")

Measured memory_bytes: 4016
import java.io.*;

public class Main {
  public static void main(String[] args) {
    try {
      BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
      String count = new String(in.readLine());
      int lineCount = Integer.parseInt(count);
      int pFlag = 0;
      int result = 0;
      for(int i = 0; i < lineCount; i++) {
        String num = new String(in.readLine());
        int iNum = Integer.parseInt(num);
        pFlag = 0;
        for(int j = 2; j <= Math.sqrt(iNum); j++) {
          if(iNum % j == 0) {
            pFlag = 1;
            break;
          }
        }
        if(pFlag == 0) {
          result++;
        }
      }
      System.out.println(result);
    } catch(IOException e) {
    }
  }
}

Measured memory_bytes: 29004
#include<iostream>
#include<math.h>
#include <algorithm>
#include<float.h>
#include <limits>
#include <vector> 
#include <numeric>
#include <string.h>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long

using namespace::std;

int jo(ll int jxo, ll int jyo){
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){
  return (toxbig-0x20);
}
char tolow(char toxlow){
  return (toxlow+0x20);
}
  


int main(){
int n,k;
  string s;
  cin>>n>>k>>s;
  s[k-1]=tolow(s[k-1]);
  cout<<s;
  
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
using namespace std;
using ll = long long;
int main()
{
    ll a[3];
    cin >> a[0] >> a[1] >> a[2];
    for (int i = 0; i < 3; ++i)
    {
        if (a[i] & 1)
        {
            cout << 0 << endl;
            return 0;
        }
    }
    if (a[0] == a[1] && a[1] == a[2])
    {
        cout << -1 << endl;
        return 0;
    }
    
    ll ans = 0, q[3];
    bool gok = true;
    while(1)
    {
        for (int i = 0; i < 3; ++i)
        {
            q[i] = a[i] / 2;
        }
        for (int i = 0; i < 3; ++i)
        {
            a[i] = q[(i + 1) % 3] + q[(i + 2) % 3];
            if (a[i] & 1) 
            {
                gok = false;
                break;
            }
        }
        ++ans;
        if (!gok) break;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int, int >
#define F first
#define S second
#define int  long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
using namespace std;
/// age ye mosh dp ro baze dashti dp tedad baz shodeye baste nashode yadet nare !!

int32_t main(){
    string s;
    cin >> s;
    ll ans=s.size();
    vector <char> c;
    c.pb(s[0]);
    for (int i=1;i<s.size();i++){
        if (c.size() && c.back()=='S' && s[i]=='T'){
            c.pop_back();
            continue;
        }
        c.pb(s[i]);
    }
    cout << c.size() << endl;
}


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

int main(void){
    int i=0;
    char a[100];
    int b[100];
    //int j;
    
    while(scanf("%s",a) != EOF){
        switch(a[0]){
        case '+' : b[i-2]+=b[i-1];
                    i--;
                    continue;
        case '-' : b[i-2] -=b[i-1];
                    i--;
                    continue;
        case '*' : b[i-2]*=b[i-1];
                    i--;
                    continue;
        default : b[i++]=atoi(a);
        }
    
        
        
        
        //for(j=0;j<i;j++){
        //    printf("%d ",b[j]);
        //}
        //puts("");
    }
    
    printf("%d\n",b[0]);
    return 0;
}

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

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string S;
	cin >> S;
	int64_t width; width = S.size();
	int64_t counter = 0; int n = 0;
	
	for (int64_t i = 0; i < width; i++){
		 if (S.at(i) == 'W') {
			 counter = counter + n;
		 }
		 else {
			 n++;
		 }
	 }
	 
	 cout << counter << endl;
}


Measured memory_bytes: 720
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
template<class T> inline bool chmax(T& a, T b) { if(a < b){ a=b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if(a > b){ a=b; return 1; } return 0;}


int main(){
	int n;
	cin >> n;
	vector<string> s(n);
	REP(i,n) cin >> s[i];
	REP(i,n) sort(s[i].begin(), s[i].end());
	sort(s.begin(), s.end());
	
	ll ans=0;
	
	ll r=0;
	REP(i,n-1){
		ll count=0;
		REP(j,10){
			if(s[i][j]==s[i+1][j]) count++;
			else if(r!=0){
				ans += (r*(r+1))/2;
				r = 0;
			}
		}
		if(count==10) r++;
	}
	
	if(r!=0){
		ans += (r*(r+1))/2;
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 6392
N = int(input())
A_list = list(map(int, input().split()))
dp = [ 0 for n in range(N)]
dp[0] = 1000
#print(dp)
for n in range(1, N):
    mymax = dp[n-1]
    for nn in range(n):
        mymoney = dp[nn] - (dp[nn]//A_list[nn] * A_list[nn]) + dp[nn]//A_list[nn]*A_list[n]
        if mymax < mymoney:
            mymax = mymoney
    dp[n] = mymax
print(dp[-1])

Measured memory_bytes: 9212
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;

int main(){
    int n, m;
    cin >> n >> m;
    Graph G(n + 1);
    for (int i = 0; i < m; i ++){
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
    }  
    vector<int> dist(n + 1, 1000000000);
    queue<int> que;

    dist[1] = 0;
    que.push(1);
    while (!que.empty()){
        int v = que.front();
        que.pop();

        for (int next_v : G[v]){
            if (dist[next_v] <= dist[v] + 1) continue;
            dist[next_v] = dist[v] + 1;
            que.push(next_v);
        }
    }
//    for (int i = 1; i <= n; i ++) cout << dist[i] << endl;
    if (dist[n] <= 2){
        cout << "POSSIBLE" << endl;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
    }
}

Measured memory_bytes: 12660
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main()
{
    ll n, m;
    cin >> n >> m;
    ll p;
    string s;
    map<ll, ll> rensou;
    map<ll, bool> ac;
    ll sum = 0;
    for (int i = 0; i < m; i++)
    {
        cin >> p >> s;
        if (s == "WA")
        {
            rensou[p]++;
        }
        if (s == "AC" && ac[p] == false)
        {
            ac[p] = true;
            sum += rensou[p];
        }
    }
    ll sumac = 0;
    for (auto g : ac)
    {
        sumac += g.second;
    }
    cout << sumac << " " << sum << endl;
}


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

using namespace std;

vector<int> g[111111];
int d[111111];
int f(int x) {
	if (d[x]) return d[x] - 1;
	for (int y : g[x])
		d[x] = max(d[x], f(y) + 1);
	return d[x]++;
}
int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		g[x].push_back(y);
	}
	for (int i = 0; i < n; i++)
		g[0].push_back(i + 1);
	cout << f(0) - 1 << endl;
	return 0;
}


Measured memory_bytes: 8312
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int sum = 0;
		
        for(int i=a; i<=b; i++){
           if(c%i==0)
            sum++;
           
        }
        System.out.println(sum);
	}
}


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

#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int main() {
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> a(q);
  rep(i, q) {
    cin >> a[i];
    a[i]--;
  }
  // 正解数
  vector<int> ac(n, 0);
  rep(i, q) {
    ac[a[i]]++;
  }

  rep(i, n) {
    cout << ((k - (q - ac[i])) > 0 ? "Yes" : "No") << endl;
  }

  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define _for(i,a,b) for(int i = (a);i <= (b);++i)
typedef long long ll;
const int maxn = 2e5+5;
const int mod = 1e9+7;
ll qpow(ll a,ll b){ll res = 1;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll sum[maxn];
int a[maxn];
int main()
{

	int n;
	scanf("%d",&n);
	for(int i = 1;i <= n;++i){
		scanf("%d",&a[i]);
		sum[i] = sum[i-1]+a[i];
		sum[i]%=mod;
	}
	ll ans = 0;
	for(int i = 1;i <= n;++i){
		ans = ans+1ll*a[i]*(sum[n]-sum[i]+mod)%mod;
		ans%=mod;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5940
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
using namespace std;
char s[4],a[4];
int n;
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(b - a == c - b) printf("YES\n");
    else printf("NO\n");
}


Measured memory_bytes: 256
#include <cstdio>

int S[10000], T[500];

int main(void){
	int n, q, cnt = 0;

	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%d", &S[i]);
	}

	scanf("%d", &q);
	for (int i = 0; i < q; i++){
		scanf("%d", &T[i]);
	}

	for (int i = 0; i < q; i++){
		for (int j = 0; j < n; j++){
			if (T[i] == S[j]){
				cnt++;
				break;
			}
		}
	}
        printf("%d\n",cnt);

	return 0;
}

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

using ll = long long;

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

    int N;
    cin >> N;

    int A[N + 1];
    for (int i = 1; i <= N; ++i) {
        cin >> A[i];
    }
    int count = 0;
    for (int i = 1; i <= N; ++i) {
        count += A[A[i]] == i;
    }

    cout << count / 2 << '\n';

    return 0;
}


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

int main() {
    int k;
    string s;
    cin >> k >> s;
    if(s.length() <= k) {
        cout << s << endl;
    } else {
        for(int i = 0; i < k; i++) cout << s[i];
        cout << "..." << endl;
    }

    return 0;
}


Measured memory_bytes: 3624
a = input()
b = input()
dp = [[0]*(len(b)+1) for i in range(len(a)+1)]
for i in range(1,len(a)+1):
  for j in range(1, len(b)+1):
    if a[i-1] == b[j-1]:
      dp[i][j] = 1 + dp[i-1][j-1]
    else:
      dp[i][j] = max(dp[i][j-1], dp[i-1][j])
#print(dp)
ans = []
p = len(a)
t = len(b)
while p>0 and t>0:
  if a[p-1] == b[t-1]:
    ans.insert(0, a[p-1])
    p = p-1
    t = t-1
  else:
    if dp[p][t-1] > dp[p-1][t]:
      t = t-1
    else:
      p = p-1
print("%s" % ''.join(ans))

Measured memory_bytes: 112604
a, b = map(int, input().split())
if a%2 == b%2: # 3, 4, 5  => 3^1 / 4, 5, 6 => 1^6
    k = (b-a)//2
    print(b^(k%2) if a%2==0 else a^(k%2))
elif a%2 == 0 and b%2 == 1: # 4, 5, 6, 7 => 1^1
    print(((b-a+1)//2)%2)
elif a%2 == 1 and b%2 ==0: # 3, 4, 5, 6 => 3^1^6
    print(a^b^((b-a-1)//2)%2)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
using namespace std;

int coin_num_to_win(int k, int K){
    int ans = 0;
    long long tmp = k;
    while(k < K){
        k *= 2;
        ans ++;
    }
    return ans;
}

long long power(int a, int b){
    long long ans = 1;
    for(int i = 0; i < b; i++){
        ans *= a;
    }
    return ans;
}

int main(){
    int N;
    int K;
    cin >> N >> K;
    double ans;
    if(N > K - 1){
        ans = 1.0 * (N - K + 1) / N;
    } else {
        ans = 0.0;
    }

    for(int i = 1; i <= min(N, K - 1); i++){
        ans += 1.0 / N / power(2, coin_num_to_win(i, K));
        //cout << coin_num_to_win(i, K) << endl;
    }    
    printf("%.32f\n", ans);
    return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let n = read!(usize);

    // dp[i] := i円を実現可能な最小の操作回数 とする
    let mut dp: Vec<usize> = vec![INF as usize; n + 1];

    dp[0] = 0; // 0円
    dp[1] = 1; // 1円
    for i in 2..(n + 1) {
        let mut count = i; // 最悪でも1円ずつi回引き出せば実現できる

        let mut six_index = 1;
        let mut nine_index = 1;
        while i >= 6usize.pow(six_index) {
            let tmp_cnt = dp[i - 6usize.pow(six_index)] + 1;
            if tmp_cnt < count {
                count = tmp_cnt;
            }
            six_index += 1;
        }
        while i >= 9usize.pow(nine_index) {
            let tmp_cnt = dp[i - 9usize.pow(nine_index)] + 1;
            if tmp_cnt < count {
                count = tmp_cnt;
            }
            nine_index += 1;
        }

        dp[i] = count;
    }

    println!("{}", dp[n]);
}


Measured memory_bytes: 4352
//#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<string>
#include<cstdlib>
#include<bitset>
#include<sstream>
#include<queue>
#include<stack>
#include<list>
#include<limits>
#include<iomanip>

using namespace std;

typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pt;
typedef pair<ll,ll> pll;

#define Max 1000001
#define intinf 2147483647
#define longlonginf 9223372036854775807
#define MOD 998244353
#define MOD2 1000000007
#define fastio ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define vint vector<int>
#define vll vector<long long>
#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define F(i,n) for(int i = 0;i<n;i++)
#define Fr(i,l,r) for(int i = l;i <= r;i++)
#define rF(i,n) for(int i = n-1;i>=0;i--)


//#define min(a,b) a>b?b:a
//#define max(a,b) a>b?a:b
#define all(arr) arr.begin(),arr.end()
//#define sort(vec) sort(vec.begin(),vec.end())
//#define reverse(vec) reverse(vec.begin(),vec.end())


ll Lpow(ll a,ll b)
{
    ll ans = 1;
    while(b > 0)
    {
        if(b%2)
            ans = (ans*a);
        a = (a*a);
        b = b/2;
    }
    return ans;
}

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


signed main()
{
    fastio;
    
    int n;
    cin >> n;
    
    vector<int> arr(n),brr(n),crr(n);
    
    F(i,n)
    cin >> arr[i] >> brr[i] >> crr[i];
    
    ll dp[n][3];
    
    dp[0][0] = arr[0];
    dp[0][1] = brr[0];
    dp[0][2] = crr[0];
    
    for(int i = 1;i<n;i++)
    {
        dp[i][0] = max(dp[i-1][1] + arr[i],dp[i-1][2] + arr[i]);
        dp[i][1] = max(dp[i-1][0] + brr[i],dp[i-1][2] + brr[i]);
        dp[i][2] = max(dp[i-1][0] + crr[i],dp[i-1][1] + crr[i]);
                
    }
    
    cout << max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2])) << endl;
    
    return 0;
}


Measured memory_bytes: 3840
#pragma GCC optimize("O3")
        #pragma comment(linker, "/stack:200000000")
        #pragma GCC optimize("unroll-loops")
         
        #include <algorithm>
        #include <bitset>
        #include <cassert>
        #include <chrono>
        #include <cmath>
        #include <complex>
        #include <cstdio>
        #include <cstdlib>
        #include <cstring>
        #include <ctime>
        #include <deque>
        #include <functional>
        #include <iomanip>
        #include <iostream>
        #include <iterator>
        #include <limits>
        #include <climits>
        #include <list>
        #include <map>
        #include <numeric>
        #include <queue>
        #include <random>
        #include <ratio>
        #include <set>
        #include <sstream>
        #include <stack>
        #include <string>
        #include <unordered_map>
        #include <unordered_set>
        #include <utility>
        #include <vector>
        using namespace std;
         
        typedef long long ll;
        typedef long double LD;
        #define int ll
        #define double LD
        #define pb push_back
        #define mp make_pair
        #define REP(i,n) for (int i = 0; i < n; i++)
        #define loop(i,n) for (int i = 0; i < n; i++)
        #define FOR(i,a,b) for (int i = a; i < b; i++)
        #define REPD(i,n) for (int i = n-1; i >= 0; i--)
        #define FORD(i,a,b) for (int i = a; i >= b; i--)
        #define remax(a,b) a = max(a,b)
        #define remin(a,b) a = min(a,b)
        #define mem(a, b) memset(a, b, sizeof a)
        #define append push_back
        #define all(v) v.begin(),v.end()
        #define F first
        #define S second
        #define print(x) cout << (x) << endl
        #define PRECISION(x) cout << fixed << setprecision(x)
        #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
        #define N 1005
        #define pb push_back
        const double PI=acos(-1);
        const int MOD = 1000000007;
        const int FMOD = 998244353;
        const double eps = 1e-9;
         
        mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
  	
signed main(){

	int n;
	cin>>n;
	
	vector<int> a(n);
	loop(i,n)
	cin>>a[i];
	
	sort(all(a));
	
	int sum=a[n-1];
        int k=n-2;
        bool f=false;
        for(int i=0;i<n-2;i++){
            sum+=a[k];
            if(f) {
                k--;
            }
            f=!f;
        }
        cout<<sum<<endl;
    }
	


Measured memory_bytes: 4828
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4

int main(){
  int N; cin >> N;
  int d[N];
  rep(i,N) cin >> d[i];
  int retval = 0;
  for (int i=0;i<N;i++){
    for (int j=i+1;j<N;j++){
      retval += d[i]*d[j];
    }
  }

  cout << retval << endl;


  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cassert>
#define INF 2000000000
using namespace std;
int dx[5]={1,0,-1,0,0},dy[5]={0,1,0,-1,0};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define mk make_pair
#define en endl
#define RE return 0
#define int ll
#define P pair<int,int>

int n,k;

signed main(){
vector<int> minu,plu;
	cin>>n>>k;
	plu.push_back(0);
	for(int i=0; i<n; i++){
		int a; cin>>a;
		if(a>0) plu.push_back(a);
		else if(a<0) minu.push_back(-a);
		else k--;
	}
	minu.push_back(0);
	reverse(minu.begin(), minu.end());
	int ans=INF;
	for(int i=0; i<=n; i++){
		int p=i,m=k-i;
		if(plu.size()-1<p||minu.size()-1<m) continue;
		int cnt;
		if(plu[p]>=minu[m]) cnt=2*minu[m]+plu[p];
		else cnt=2*plu[p]+minu[m];
		ans=min(ans,cnt);
	}
	cout<<ans<<en;
}





Measured memory_bytes: 1656
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i;<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)

int main(void){
 	string s;
  cin >> s;
  int ans;
  if (s == "SAT") ans = 1;
  else if (s == "SUN") ans = 7;
  else if (s == "MON") ans = 6;
  else if (s == "TUE") ans = 5;
  else if (s == "WED") ans = 4;
  else if (s == "THU") ans = 3;
  else if (s == "FRI") ans = 2;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define speed_up ios_base::sync_with_stdio(false); cin.tie(NULL)
#define ll long long
#define ara(A,N) sort(A,A+N)
#define rev(A,N) sort(A,A+N,greater<long long>())
using namespace std;
int main()
{
  speed_up;
  string s;
  cin>>s;
  ll i, a, z, n, j = 1, k = 1;
  n = s.size() - 1;
  for(i = 0; i<=n; i++)
  {
      if(s[i] == 'A' && j == 1)
      {
          a = i;
          j--;
      }
      if(s[n - i] == 'Z' && k == 1)
      {
          z = n - i;
          k--;
      }

  }
  cout<<z - a + 1<<endl;

return 0;
}



Measured memory_bytes: 3744
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <bitset>
#define ll long long
using namespace std;




int main(){
   
int even=0,odd=0;
int N;cin>>N;

for(int i=0;i<N;i++){
    int a;cin>>a;
    if(a%2==0) even++;
    else odd++;
}

even += odd/2;

if(odd %2 ==0 ){
    cout<<"YES"<<endl;
} else {
    cout<<"NO"<<endl;
}
    return 0;
    
}

 



Measured memory_bytes: 256
#pragma GCC optimize("Ofast", "unroll-loops")

// #define USE_ACL

#include <bits/stdc++.h>
#ifdef USE_ACL
#include <atcoder/all>
#endif

using namespace std;
#ifdef USE_ACL
using namespace atcoder;
#endif

#define ll __int128

map<ll, int> prime_factor(ll n){
    map<ll, int> ret;
    for (ll i = 2; i * i <= n; ++i){
        while (n % i == 0){
            ++ret[i]; n /= i;
        }
    }
    if (n != 1) ret[n] = 1;
    return ret;
}

/* aとbの最大公約数を求める. */
ll gcd(ll a, ll b){
    if (b > a) return gcd(b, a);
    if (b == 0) return a;
    return gcd(b, a % b);
}

/* ax+by=gcd(a,b)を満たす(x,y)を格納し、gcd(a,b)を返す. */
ll extgcd(ll a, ll b, ll& x, ll& y){
    if (b > a) return extgcd(b, a, y, x);
    if (b == 0){
        x = 1; y = 0;
        return a;
    }
    ll g = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
    return g;
}

/* mod mでのaの逆元を求める.(gcd(a,m) = 1) */
ll modinv(ll a, ll m){
    ll x, y;
    extgcd(a, m, x, y);
    return (m + x % m) % m;
}

/* 連立線形方程式を解く.
        A[i] * x ≡ B[i] (mod M[i])
    なる方程式の解が
        x ≡ b (mod m)
    とかけるとき、(b, m)を返す.(存在しなければ(0, -1)) */
pair<ll, ll> liner_congruence(
    vector<ll> A, vector<ll> B, vector<ll> M
){
    ll x = 0, m = 1;

    for (int i = 0; i < A.size(); ++i){
        ll a = A[i] * m,
         b = B[i] - A[i] * x,
         d = gcd(M[i], a);

        if (b % d != 0) // 解なし
            return make_pair(0, -1);
        
        ll t = b / d * modinv(a / d, M[i] / d) % (M[i] / d);
        x = x + m * t;
        m *= M[i] / d;
    }

    return make_pair(x % m, m);
}

ll N;

void input(void){
  long long tmp; cin >> tmp;
  N = tmp;
}

ll _pow(ll a, ll b){
  if (b == 0) return 1;
  ll tmp = _pow(a, b / 2);
  if (b % 2 == 0) return tmp * tmp;
  return tmp * tmp * a;
}

ll solve(void){
  ll ret = (1LL << 60);
  map<ll, int> p = prime_factor(2 * N);
  vector<pair<ll, int>> pf;
  for (auto pi : p)
    pf.push_back({pi.first, pi.second});
  int k = p.size();
  for (int f = 0; f < (1 << k); ++f){
    ll tmp1 = 1, tmp2 = 1;
    for (int i = 0; i < k; ++i){
      if (f & (1 << i)) tmp1 *= _pow(pf[i].first, pf[i].second);
      else tmp2 *= _pow(pf[i].first, pf[i].second);
    }
    auto res = liner_congruence({1, 1}, {0, tmp2 - 1}, {tmp1, tmp2});
    if (res == (pair<ll, ll>){0, -1}) continue;
    ll tmp = res.first;
    if (tmp == 0) tmp += res.second;
    ret = min(ret, tmp);
  }
  return ret;
}

int main(void){
  input();
  cout << ((long long)solve()) << endl;
  return 0;
}

Measured memory_bytes: 3648
def solve():
    n = int(input())
    a = []
    b = []
    c = []
    d = []
    for i in range(n):
        a_, b_ = map(int, input().split())
        a.append(a_)
        b.append(b_)

    for i in range(n):
        c_, d_ = map(int, input().split())
        c.append(c_)
        d.append(d_)

    import numpy as np
    a, b, c, d = np.array(a), np.array(b), np.array(c), np.array(d)

    arg = np.argsort(b)[::-1]
    a = a[arg]
    b = b[arg]

    argc = np.argsort(c)
    c = c[argc]
    d = d[argc]


    n_pair = 0
    for i in range(n):
        c_, d_ = c[i], d[i]
        for j, a_ in enumerate(a):
            b_ = b[j]
            if a_ < c_ and b_ < d_:
                n_pair += 1
                a = np.delete(a, j)
                b = np.delete(b, j)
                #print(a_, b_, c_, d_)
                break

    print(n_pair)

solve()

Measured memory_bytes: 21528
// In The Name Of God

#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll long long

using namespace std;

int n;
const int maxn = 1e2 + 100;
int a[maxn], b[maxn], ans, maxx;

int main()
{
    IOS;
    cin >> n;

	for(int i = 1; i <= n; i ++)
	{
		int j = 1;
		while(i * j < n)
		{
		//	cout << i << ' ' << j << endl;
			j ++;
			ans ++;
		}
	}
	return cout << ans << endl, 0;
}


Measured memory_bytes: 3608