akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        
        for (int i=0;i<w+2;i++){
            System.out.print("#");
        }
        System.out.println();

        for (int i=0; i<h; i++){
            System.out.print("#");
            System.out.print(sc.next());
            System.out.println("#");
        }

        for (int i=0;i<w+2;i++){
            System.out.print("#");
        }
        System.out.println();
    }
}

Measured memory_bytes: 23892
import java.util.Scanner;

/**
 * test
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();

        long lcm = c * d / gcd(c, d);
        //System.out.println(lcm);

        System.out
                .println(b - a + 1 - (b / c) - (b / d) + ((a - 1) / c) + ((a - 1) / d) + ((b / lcm) - ((a - 1) / lcm)));
    }

    private static long gcd(long a, long b) {
        while (b > 0) {
            long tmp = a % b;
            a = b;
            b = tmp;
        }
        return a;
    }
}

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

#define mod 1000000007
#define MAX 100005
using namespace std; 

int findb(int b[],int i,int r){

	int ret=upper_bound(b,b+r,i)-b;
	if(ret==r)return -1;
	else return b[ret];

}  

int c2(int k){
	return(k*(k-1)/2);
}

int main(){

	int n;cin>>n;
	int a;
	int st[n+1];
	for(int i=1;i<=n;i++){cin>>a;st[a]=i;}
	for(int i=1;i<=n;i++)cout<<st[i]<<" ";
}



Measured memory_bytes: 1152
package main

import (
	"fmt"
	"log"
)

func main() {
	//fmt.Print("Enter a grade: ")
	var K,i,j int // or grade := 0
	_, err := fmt.Scanf("%d", &K) // or %f and change grade to float64
  _, err2 := fmt.Scanf("%d", &i) // or %f and change grade to float64
  _, err3 :=fmt.Scanf("%d", &j)

	if err != nil || err2 !=nil|| err3 !=nil{
		log.Fatal(err)
	}
	/*fmt.Printf("A grade of %d%% is", K)
  fmt.Println()
  fmt.Printf("A grade of %d%% is", i)
  fmt.Println()
  fmt.Printf("A grade of %d%% is", j)*/

	if K >= i && K<=j {
		fmt.Println("OK")
	} else if K <i && K*2>j{
		fmt.Println("NG")
	}else if K >j{
		fmt.Println("NG")
	}else{
      temp:= false
      for x:= i; x<j;x++{
        if x%K ==0{
          fmt.Println("OK")
          temp = true
          break
        }
      }
      if temp == false{
      	fmt.Println("OK")
      }
  }
}


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

int	main()
{
	char c;
	cin >> c;

	if (c == 'a' or c == 'e' or c == 'u'
			or c == 'i' or c == 'o')
		cout << "vowel" << endl;
	else
		cout << "consonant" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main {
    public void kami() {
           Scanner sc = new Scanner(System.in);
		int i = 1;
		int x = sc.nextInt();
		while(x != 0){
			System.out.println("Case " + i + ": " + x);
			i++;
			x = sc.nextInt();
		}

    }
    public static void main(String[] args) {
    new Main().kami();
     	}

}

Measured memory_bytes: 33168
bit=[0]*9
fa=[1]*9
for n in range(1,9):fa[n]=fa[n-1]*n
def up(id):
    while id<9:
        bit[id]+=1
        id+=id&(-id)
def qr(id):
    res=0
    while id:
        res+=bit[id]
        id-=id&(-id)
    return res

x=int(input())
s=list(map(int,input().split()))
z=list(map(int,input().split()))

v=''

for n in s:
    a=qr(n)
    vl=n-1-a
    v+=str(vl)
    up(n)
v=v[::-1]
r1=0
for n in range(len(v)):
    r1+=int(v[n])*fa[n]

r2=0
v=''
bit=[0]*9
for n in z:
    a=qr(n)
    vl=n-1-a
    v+=str(vl)
    up(n)
v=v[::-1]
for n in range(len(v)):
    r2+=int(v[n])*fa[n]

print(abs(r1-r2))

Measured memory_bytes: 9184
//coded by not_surrender

#pragma GCC optimize( "Ofast" )

#include <bits/stdc++.h>

#define MAXN 3003
#define oo (1<<30)
#define MOD 998244353
#define mid ((a+b)/2)
#define L (nod*2)
#define R (nod*2+1)
#define pb push_back

using namespace std;

typedef long long ll;
typedef vector <int> vi;

int N, M, dp[MAXN][MAXN][2];

char A[MAXN], B[MAXN];

void printPath( int a, int b ){
	if ( !a || !b )
		return;
	while ( B[b] != A[a] )
		--b;
	printPath( dp[a][b][1], b-1 );
	cout << A[a];
}

int main(){

    #ifndef ONLINE_JUDGE
        //~ freopen( "a.txt", "r", stdin );
    #endif // ONLINE_JUDGE

    ios_base::sync_with_stdio( false );
    cin.tie( NULL ), cout.tie( NULL );
    
    cin >> (A+1) >> (B+1);
    
    N = strlen( (A+1) );
    M = strlen( (B+1) );
    
    for ( int i = 1; i <= N+1; ++i ){
		for ( int j = 1; j <= M+1; ++j ){
			if ( dp[i][j][0]+(A[i] == B[j]) > dp[i+1][j+1][0] )
				dp[i+1][j+1][0] = dp[i][j][0]+(A[i] == B[j]), dp[i+1][j+1][1] = (A[i] == B[j]?i:dp[i][j][1]);
			if ( dp[i][j][0] > dp[i+1][j][0] )
				dp[i+1][j][0] = dp[i][j][0], dp[i+1][j][1] = dp[i][j][1];
			if ( dp[i][j][0] > dp[i][j+1][0] )
				dp[i][j+1][0] = dp[i][j][0], dp[i][j+1][1] = dp[i][j][1];
		}
	}
	
	if ( dp[N+1][M+1][1] )
		printPath( dp[N+1][M+1][1], M+1 ), cout << '\n';
	
return 0;
}


Measured memory_bytes: 70656
use std::io;

fn main() {
    let (n, m, l) = input_size();
    let m1 = input(n, m);
    let m2 = input(m, l);

    for i in 0..n {
        for j in 0..l {
            let c: i64 = m1[i].iter().enumerate().map(|(k, &v)| v * m2[k][j]).sum();

            if j < l - 1 {
                print!("{} ", c);
            } else {
                println!("{}", c);
            }
        }
    }
}

fn input_size() -> (usize, usize, usize) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    let mut iter = s.trim().split_whitespace();

    let n: usize = iter.next().unwrap().parse().unwrap();
    let m: usize = iter.next().unwrap().parse().unwrap();
    let l: usize = iter.next().unwrap().parse().unwrap();

    (n, m, l)
}

fn input(n: usize, m: usize) -> Vec<Vec<i64>> {
    let mut mat: Vec<Vec<i64>> = vec![];
    for i in 0..n {
        let mut s = String::new();
        io::stdin().read_line(&mut s).expect("");
        let mut iter = s.trim().split_whitespace();

        let mut v = vec![];
        for _ in 0..m {
            v.push(iter.next().unwrap().parse().unwrap());
        }
        mat.push(v);
    }

    mat
}



Measured memory_bytes: 5052
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6+5;
int a[MAXN]={0};
map<int,int>mm;
int solve(int n){
    if(mm[n]>1||(mm[1]&&n!=1))
        return 0;
    for(int i=2;i*i<=n;++i){
        if(n%i==0){
            mm[n]--;
            if(mm[n/i]||mm[i]){
                mm[n]++;
                return 0;
            }
            mm[n]++;
        }
    }
    return 1;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a[i];
        mm[a[i]]++;
    }
    int ans = 0;
    for(int i=0;i<n;i++){
        ans+=solve(a[i]);
    }
    cout <<ans << endl;
    return 0;
}


Measured memory_bytes: 33308
const processData = (lines) => {
  const a = lines[0]
  const b = lines[1]
  let counter = 0
  for (let i=0; i<a.length; i++) {
    if (a[i] !== b[i]) {
      counter++
    }
  }
  console.log(counter)
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})


Measured memory_bytes: 33728
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

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

    string S, T;
    cin>>S>>T;
    int A, B;
    cin>>A>>B;
    string U;
    cin>>U;

    if (S == U) cout<<A - 1<<" "<<B<<endl;
    else cout<<A<<" "<<B - 1<<endl;
}

Measured memory_bytes: 256
'''input
2 2
1 2
3 4
3 4
2 1
'''
# A coding delight
from sys import stdin, stdout
import gc
from copy import deepcopy
gc.disable()
input = stdin.readline

	
# main starts
k, x = list(map(int, input().split()))
if k * 500 >= x:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 3568
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <set>
#include <map>
#include <unordered_map>
#include <vector>
#include <queue>
#include <string>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <random>
#include <chrono>
#include <bitset>
#include <fstream>
#include <sstream>

using namespace std;

typedef long long ll;
typedef long double ld;

ll big = 1000000007ll;
float likeabutterfly;
string likeabee;
ll n,m,q,h,k,w;
ll T;

vector<ll> A;


int main()
{
    ll c1,c2,c3,c4,c5,c6;
    ll a,b,d,e,c;
    ll x,y,z;
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);


    cin >> n;
    string s1,s2;
    cin >> s1;
    cin >> s2;

    ll ans = 2*n;

    for(c1 = 0; c1 <= n; c1++){

        bool yes = 1;

        for(c2 = n-c1; c2 < n; c2++){
            if(s1[c2] != s2[c2-n+c1])yes = 0;
        }
        if(yes == 1)ans = 2*n - c1;

    }

    cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
typedef long long ll;
using namespace std;
const int maxn=110;
int n;
int ai[maxn];
int main(){
    scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&ai[i]);
	int ans=1e7+100;
	for(int i=-100;i<=100;i++){
		int res=0;
		for(int j=1;j<=n;j++) res+=abs((i-ai[j])*(i-ai[j]));
		ans=min(res,ans);
	}
	printf("%d\n",ans);
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n), p(n);
    rep(i, n){
        cin >> a[i];
        p[i] = a[i];
    }
    sort(p.begin(), p.end());
    int max1 = p[n - 1];
    int max2 = p[n - 2];
    rep(i,n){
        if(a[i] != max1){
            cout << max1 << endl;   
        }else{
            cout << max2 << endl;  
        }        
    }
    return 0;
}

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

const int MOD=2019;

int64_t modpow(int64_t a,int64_t n){
  int64_t res=1;
  if(n==0) return res;
  while(n>0){
    if(n&1) res=(res*a)%MOD;
    a=(a*a)%MOD;
    n >>= 1;
  }
  return res;
}

int main(){
  string S;
  cin>>S;
  int N=S.size();

  //i-1文字目までの2019で割った余りをv[i]とする
  map<int64_t,int64_t> m;
  ++m[0];

  int64_t ch=0;
  for(int i=0;i<N;++i){
    int64_t n=S[N-1-i]-'0';
    n *= modpow(10,i);
    ch += n;
    ch %= MOD;
    ++m[ch];
  }

  int64_t ans=0;
  for(auto p:m){
    ans += p.second*(p.second-1);
  }
  cout<<ans/2<<endl;

}


Measured memory_bytes: 3728
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, LL> Vec2;
typedef tuple<LL, LL, LL> Tll;
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,n) for(LL i=n-1;i>=0;i--)
struct Edge { LL to, cost; };
vector<Edge>vec[1100000];
LL h, w, n, m, s, t, ans = 0, a[1000000],pos[1000000][2],sum;
Ppll b[1000000];
int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i] >> pos[i][0] >> pos[i][1];
		b[i].first = a[i];
		b[i].second.first = pos[i][0];
		b[i].second.second = pos[i][1];
	}
	sort(b, b + n, [](Ppll aa, Ppll ss) {return aa.first < ss.first; });
	Pll now(0, 0);
	rep(i, n) {
		if ((b[i].second.first + b[i].second.second) % 2 == b[i].first % 2&&
	       sum + abs(now.first - b[i].second.first)+ abs(now.second - b[i].second.second)<= b[i].first) {
				sum = b[i].first;
				now.first = b[i].second.first;
				now.second = b[i].second.second;
		}
		else {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 38144
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8 ff=unix


def solv(S):
    if S == 'AAA' or S == 'BBB':
        return 'No'
    return 'Yes'


if __name__ == "__main__":

    S = input()
    ans = solv(S)

    print(ans)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
const int N=100000+10;
typedef long long ll;
int n,m,v,p;
int a[N];
ll sum[N];
int cal(int l,int r){return r-l+1;}
int check(int mid){
	if(n-mid+1<=p)return 1;
	if(a[mid]+m<a[n-p+1])return 0;
	if(p+mid-1>=v)
		return 1;
	else{
		if(cal(mid+1,n-p+1)>=v-(p+mid-1))
			return (ll)(a[mid]+m)*cal(mid+1,n-p+1)-(sum[n-p+1]-sum[mid])>=(ll)(v-(p+mid-1))*m;
		else
			return 0;
	}
}
int main(){
	cin>>n>>m>>v>>p;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
		sum[i]=sum[i-1]+a[i];
	int l=1,r=n,ans=n;
	while(l<=r){
		int mid=(l+r)>>1;
		if(check(mid))
			ans=mid,r=mid-1;
		else
			l=mid+1;
	}
	while(ans>1&&a[ans-1]==a[ans])ans--;
	cout<<n-ans+1;
	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main() {
	string S;
	cin >> S;
	int n=0;
	for (int i = 0; i < 3; i++) {
		if (S[i] == 'o') {
			n++;
		}
	}
	cout << 700 + 100 * n << endl;
}


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

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

int main(){
    int k, a, b;
    cin >> k >> a >> b;
    for ( int i = a; i <= b; i++ ) {
        if ( i % k == 0 ) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}


Measured memory_bytes: 3632
import scala.io.StdIn._

object Main{
  def solve(a : Int, b : Int, n : Int):(Int, Int) = {
    var ansA = a
    var ansB = b
    for(i <- 1 to n){
      if((i & 1) == 0){
        ansB /= 2
        ansA += ansB
      }
      else{
        ansA /= 2
        ansB += ansA
      }
    }
    (ansA, ansB)
  }

  def main(arg : Array[String]){
    val input = readLine().split(" ").map(_.toInt)
    val (a, b) : (Int, Int) = solve(input(0), input(1), input(2))
    println(f"$a $b")
  }
}


Measured memory_bytes: 27344
#include<iostream>
#include<algorithm>

using namespace std;

int main() {

    int n;

    bool S[13], H[13], C[13], D[13];
    fill(S, S + 13, false);
    fill(H, H + 13, false);
    fill(C, C + 13, false);
    fill(D, D + 13, false);

    std::cin >> n;

    for(int i = 0; i < n; i++) {
        char a;
        int b;

        std::cin >> a >> b;

        switch (a) {
            case 'S':
                S[b - 1] = true;
                break;
            case 'H':
                H[b - 1] = true;
                break;
            case 'C':
                C[b - 1] = true;
                break;
            case 'D':
                D[b - 1] = true;
                break;
        }
    }

    // std::cout << "XXXXXXXXXXXXXXXXXXXXX\n";

    for (int i = 0; i < 4; i++) {
        for(int j = 0; j < 13; j++) {
            switch (i) {
                case 0:
                    if (S[j] == false) {
                        std::cout << "S " << j + 1 << endl; 
                    }
                    break;
                case 1:
                    if (H[j] == false) {
                        std::cout << "H " << j + 1 << endl; 
                    }
                    break;
                case 2:
                    if (C[j] == false) {
                        std::cout << "C " << j + 1 << endl; 
                    }
                    break;
                case 3:
                    if (D[j] == false) {
                        std::cout << "D " << j + 1 << endl; 
                    }
                    break;
            }
        }
    }

    return 0;
}


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

#define ll             long long
#define LL             long long
#define pii            pair<int, int>
#define pll            pair<ll, ll>
#define pil            pair<int, ll>
#define pli            pair<ll, int>
#define vi             vector<int>
#define vl             vector<ll>
#define vii            vector<pii>
#define vll            vector<pll>
#define vil            vector<pil>
#define vli            vector<pli>
#define pb             push_back
#define ppb            pop_back
#define mp             make_pair
#define ff             first
#define ss             second
#define sz(x)          (int)x.size()
#define TN             typename
#define all(v)         v.begin(), v.end()
#define fill(a, b)     memset(a, b, sizeof(a))
#define endl           '\n'

template <TN T> T gcd(T a, T b) {return !b ? a : gcd(b, a % b);}
template <TN T> T lcm(T a, T b) {return a * (b / gcd(a, b));}
template <TN T> T sqr(T a) {return a * a;}
template <TN T> T cube(T a) {return a * a * a;}
template <TN T> inline void smin(T &a, T b) {a = a < b ? a : b;}
template <TN T> inline void smax(T &a, T b) {a = a > b ? a : b;}

template <TN T> inline void Int(T &n) {
	n = 0; int f = 1; register int ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
	for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
	n = n * f;
}

#define error(args...) {vector <string> _v = split(#args, ','); err(_v.begin(), args); cout << endl;}
vector <string> split(const string &s, char c) {
	vector <string> v;
	stringstream ss(s); string x;
	while (getline(ss, x, c)) v.emplace_back(x);
	return move(v);
}
void err(vector <string> :: iterator it) {}
template <typename T, typename... Args>
void err(vector <string> :: iterator it, T a, Args... args) {
	cout << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", ";
	err(++it, args...);
}

inline int in() {int n; scanf("%d", &n); return n;}
inline ll Lin() {ll n; scanf("%lld", &n); return n;}
inline double Din() {double n; scanf("%lf", &n); return n;}

inline int add(int a, int b, int mod) {a += b; return a >= mod ? a - mod : a;}
inline int sub(int a, int b, int mod) {a -= b; return a < 0 ? a + mod : a;}
inline int mul(int a, int b, int mod) {return (ll)a * b % mod;}

const int N          = 2e5 + 5;
const ll  Mod        = (ll)1e9 + 7;
const int inf        = (int)2e9;
const ll  Inf        = (ll)1e18;
const int mod        = (int)1e9 + 7;

vi g[N];
int deg[N], vis[N], dp[N];

void dfs(int u) {
	vis[u] = 1;
	for (auto v : g[u]) {
		smax(dp[v], dp[u] + 1);
		deg[v]--;
		if (!deg[v]) dfs(v);
	}
}

int solve() {
	int n = in(), m = in();
	while (m--) {
		int u = in(), v = in();
		g[u].pb(v);
		deg[v]++;
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (!vis[i] && !deg[i]) dfs(i);
	}
	for (int i = 1; i <= n; i++) {
		smax(ans, dp[i]);
	}
	printf("%d\n", ans);
	return 0;
}

int main() {
	int test = 1, tc = 0;
	//scanf("%d", &test);
	while (test--) {
		//printf("Case %d: ", ++tc);
		solve();
	}
	return 0;
}

Measured memory_bytes: 12672
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  vector<ll>vec(5);
  for(ll i=0;i<5;i++){
    cin>>vec.at(i);
  }
  ll a;
  cin>>a;
  if(vec.at(4)-vec.at(0)>a){
    cout<<":("<<endl;
  }
  else{
    cout<<"Yay!"<<endl;
  }


  return 0;
  
}


Measured memory_bytes: 3564
INF = 1145141919810364364334

n = int(input())
p = []
for i in range(n):
    a,b = map(int,input().split())
    if i==0:
        p.append(a)
        p.append(b)
    else:
        p.append(b)
    
cost = [[INF] * (n+1) for i in range(n+1)]
for i in range(n+1):
    cost[i][i] = 0
    
for l in range(2,n+1):
    for i in range(1,n-l+2):
        j = i+l-1
        for k in range(i,j):
            cost[i][j] = min(cost[i][j] , cost[i][k] + cost[k+1][j] + p[i-1]*p[k]*p[j])
            
print(cost[1][n])


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

using namespace std;

int main() {
	long long A, B, N;
	long long ans, x;
	cin >> A >> B >> N;
	
	if (N < B)
		x = N;
	else
		x = B - 1;
	ans = (A*x) / B;
	cout << ans <<endl;
}

Measured memory_bytes: 3604
n,m = list(map(int, input().split()))
x = []
ans = [0]*n
answ = 0
s,c = [], []

def has_duplicates(seq):
    return len(seq) != len(set(seq))

for i in range(m):
  x.append(list(map(int,input().split())))
  
#重複を取り除く
x = list(map(list, set(map(tuple, x))))

for i,j in x:
  s.append(i)
  c.append(j)

if (n == 1) and (m == 0):
  print(0)
elif m == 0:
  ans[0] = 1
  for i in range(len(ans)):
    answ += ans[i]*(10**(n-1-i))
    
  print(answ)
elif has_duplicates(s):
  print(-1)
elif (n == 1) and (c.count(0) == 1):
  print(0)
else:
  for i,j in x:
    ans[i-1] = j
    
  if (ans[0] == 0) and (s.count(1) == 0):
    ans[0] = 1
    
  for i in range(len(ans)):
    answ += ans[i]*(10**(n-1-i))

  if ans[0] == 0:
    print(-1)
  else:
    print(answ)

Measured memory_bytes: 3064
S=input()


nagasa=len(S)
count=0
for i in range(nagasa):
    if (i+1)%2==1:    
        if S[i]=="R" or S[i]=="U" or S[i]=="D":
            count+=0
        else:
            print("No")
            exit()
    else:
        if S[i]=="L" or S[i]=="U" or S[i]=="D":
            count+=0
        else:
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 3064
#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() {
    double l;
    cin >> l;

    double ans = l*l*l/27;

    cout << std::fixed << std::setprecision(12) << ans << endl;



    return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [Scanner.string() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [Scanner.int() for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def solve():
    S = Scanner.string().split()
    getcontext().rounding = ROUND_DOWN
    A = Decimal(S[0])
    B = Decimal(S[1])
    ans = A * B
    print(ans.__int__())


def main():
    # sys.stdin = open("sample.txt")
    # print('YNEOS'[not solve()::2])
    solve()


if __name__ == "__main__":
    main()


Measured memory_bytes: 10852
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#include<complex>
#include<bitset>
#include<chrono>
#include<boost/multiprecision/cpp_int.hpp>
#define int int64_t
#define uint uint64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define Min(x) *min_element(ALL(x))
#define Max(x) *max_element(ALL(x))
#define Unique(L) (L.erase(unique(ALL(L)), L.end()))
#define veccat(v1, v2) std::copy((v2).begin(),(v2).end(),std::back_inserter(v1)/*v1の後ろにv2を入れる*/)
#define intmax (std::numeric_limits<int64_t>::max() / 4)
using namespace std;
typedef boost::multiprecision::cpp_int bigint;
const double EPS = 1e-9;
const double PI = acos(-1.0);




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

	int n;
	cin >> n;
	vector<int>a(n);
	rep(i, n)cin >> a[i];



	vector<pair<int,int>>b;
	int L = 0, R = 0;
	rep(i, n) {
		b.push_back(make_pair(i%2?R:L,a[i]));
		L++;R--;
	}
	if (n % 2)rep(i, n)b[i].first *= -1;
	sort(ALL(b));
	rep(i, n) {
		if (i)cout << " ";
		cout << b[i].second;
	}
	cout << endl;



	return 0;
}





Measured memory_bytes: 8048
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 998244353
using namespace std;
using ll = long long;
using ldb = long double;

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

	ll ans = a[0] - 1, mx = 2;
	for (int i = 1; i < N; i++) {
		if (a[i] == mx)mx++;
		else ans += (a[i] - 1) / mx;
		//cout << "ans=" << ans << endl;
	}

	cout << ans << endl;
}

Measured memory_bytes: 4024
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int inf=0x3f3f3f3f;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n;
	cin>>n;
	if(n>=30)
		cout<<"Yes\n";
	else
		cout<<"No\n";
	return 0;
}




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

#define ll long long
#define ld long double

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define repA(i,A)   for(auto i:A)

#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)	A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V> 
#define Vpll vector<pll>

#define endl "\n"

const ll logN = 20;
const ll N = 100005;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

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

ll A[N];

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    string s;
    cin>>s;
    ll n = s.length();
    ll a=0,b=0;
    ll l=-1;
    s+='R';
    rep(i,0,n){
    	if(s[i]=='L' and s[i+1]=='R'){
    		b++;
    		A[l]=a/2+b/2+(a%2!=0);
    		A[l+1]=a/2+b/2+(b%2!=0);
    		a=0;b=0;
    	}
    	else if(s[i]=='L')	b++;
    	else a++,l=i;
    }
    rep(i,0,n)	cout<<A[i]<<" ";cout<<endl;
    return 0;
}

Measured memory_bytes: 1488
#include<iostream>
#include<string>
#include<map>

using namespace std;

int main(){
    int n, m, p, ac=0, pe=0;
    string s;
    map<int, bool> state;
    map<int, int> pena;
    cin >> n >> m;
    for(int i=0;i<m;i++){
        cin >> p >> s;
        if(!state[p]){
            if(s=="AC"){
                ac++;
                pe += pena[p];
                state[p]=true;
            }
            else{
                pena[p]++;
            }
        }
    }
    cout << ac << ' ' << pe << endl;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int N, M;
    cin >> N >> M;
    int cnt[N], red[N] = {};
    for(int i = 0; i < N; i++) cnt[i] = 1;
    red[0] = 1;

    for(int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        cnt[x]--;
        cnt[y]++;
        if(red[x] == 1) red[y] = 1;
        if(cnt[x] <= 0) red[x] = 0;
    }
    int tmp = 0;
    for(int i = 0; i < N; i++)
        if(red[i] == 1) tmp++;
    cout << tmp << "\n";
    return 0;
}

Measured memory_bytes: 1024
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
class ProgramB
    {
        static void Main(string[] args)
        {
            
            //入力
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int k = int.Parse(input[1]);
            int count = 0;
            //すべての和を求める
            while(n != 0)
            {
                n /= k;
                count++;
            }

            Console.WriteLine(count);
    
        }
    }

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

int main() {
  int H, W, K; cin >> H >> W >> K;
  vector<string> S(H);
  for (int i = 0; i < H; i++) cin >> S.at(i);
  // 横方向の分割は bit 全探索で
  int ans = 1000000007;
  for (int bit = 0; bit < (1 << (H-1)); bit++) {
    int group = 0;  // グループ数
    vector<int> id(H);  // id[i] := i 行目が属するグループ番号
    for (int i = 0; i < H; i++) {
      id.at(i) = group;
      if ((bit >> i) & 1) group++;
    }
    group++;
    vector<vector<int>> C(group, vector<int>(W, 0));
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        C.at(id.at(i)).at(j) += (S.at(i).at(j) - '0');
      }
    }
    int div = group - 1;
    // 各グループに含まれる "1" の数
    vector<int> cnt(group, 0);
    // 1 列ずつ追加していき、いずれかのグループが K 個を超えたら分割
    for (int j = 0; j < W; j++) {
      bool quit = false;  // 打ち切り
      bool exceed = false;
      for (int i = 0; i < group; i++) {
        if (C.at(i).at(j) > K) {
          quit = true;
          div = 1000000007;
          break;
        }
        cnt.at(i) += C.at(i).at(j);
        if (cnt.at(i) > K) exceed = true;
      }
      if (quit) break;
      if (exceed) {
        div++;
        cnt = vector<int>(group, 0);
        for (int i = 0; i < group; i++) cnt.at(i) += C.at(i).at(j);
      }
    }
    ans = min(ans, div);
  }
  cout << ans << endl;
}

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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



void _main() {
        int n, m; cin >> n >> m;
        vector<string> grid(n);
        for (int i = 0; i < n; i++) cin >> grid[i];

        auto nothing = [&](int i, int j) -> bool {
                return i < 0 || j < 0 || i >= n || j >= m || grid[i][j] == '.';
        };

        for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                        if (grid[i][j] == '.') continue;
                        if (nothing(i - 1, j) && nothing(i + 1, j) && nothing(i, j - 1) && nothing(i, j + 1)) {
                                cout << "No";
                                return;
                        }
                }
        }

        cout << "Yes";
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)

const ll MOD = (ll)1e9 + 7;
const ll HIGHINF = (ll)1e18;

int main() {
  ll n, a, b; cin >> n >> a >> b;
  vvll ab(a, vll());
  if (a+b-1>n || a*b<n) cout << -1 << endl;
  else {
    ll i = 1;
    while (n - i*b > a-i) {
      for (ll j=i*b; j>(i-1)*b; j--) ab.at(i-1).push_back(j);
      i++;
    }
    for (ll j=n-(a-i); j>(i-1)*b; j--) ab.at(i-1).push_back(j);
    i++;
    for (ll j=n-(a-i); j<=n; j++, i++) ab.at(i-1).push_back(j);
  }
  REP(i, a) {
    REP(j, ab.at(i).size()) {
      cout << ab.at(i).at(j);
      if (i != a-1 || j != ab.at(i).size()-1) cout << ' ';
    }
  }
  return 0;
}


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

int main(){
	int H, W;
	
	while(1){
		cin >> H >> W;
		
		if(H == 0 && W == 0) break;
		for(int i=0; i<H; i++){
		for(int j=0; j<W; j++){
			cout << "#";
		}
			cout << "\n";
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1156
# Input the amount of money Takahashi paid
N = int(input())

# Check if the price before tax is X, for X = 1, 2, 3, ..., N
ans = -1
for i in range(1, N + 1):
	if int(i * 1.08) == N:
		ans = i

# Print answer
if ans != -1:
	print(ans)
else:
	print(":(")


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

int main() {

    constexpr ll nlimit = 10000000LL;
    vector<bool> is_prime(nlimit + 1, true);
    is_prime[0] = is_prime[1] = false;
    for (ll i = 2; i <= nlimit; i++) {
        if (!is_prime[i]) continue;
        for (ll j = i * 2; j <= nlimit; j += i) {
            is_prime[j] = false;
        }
    }

    vector<ll> yotsugo = {13}; yotsugo.reserve(100000);
    for (ll i = 19; i <= nlimit; i += 10) {
        if (is_prime[i] && is_prime[i-2] && is_prime[i-6] && is_prime[i-8]) {
            yotsugo.push_back(i);
        }
    }
    
    ll n;
    while (cin >> n, n) {

        auto ub = --upper_bound(yotsugo.begin(), yotsugo.end(), n);

        cout << *ub << endl;

    }

}


Measured memory_bytes: 4116
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <iomanip>
  
using namespace std;

#define pi 3.141592653589793
#define SENTINEL 1000000001

int cnt = 0;

void Merge(int a[], int left, int mid, int right)
{
	int n1 = mid - left;
	int n2 = right - mid;
	int L[250001], R[250001];
	for(int i = 0; i < n1; i++){
		L[i] = a[left + i];
	}
	for(int i = 0; i < n2; i++){
		R[i] = a[mid + i];
	}
	L[n1] = SENTINEL;
	R[n2] = SENTINEL;
	int i = 0, j = 0;
	for(int k = left; k < right; k++){
		if(L[i] <= R[j]){
			a[k] = L[i];
			i++;
		} else {
			a[k] = R[j];
			j++;
		}
		cnt++;
	}
	return;
}

void MergeSort(int a[], int left, int right)
{
	if(left + 1 < right){
		int mid = (left + right) / 2;
		MergeSort(a, left, mid);
		MergeSort(a, mid, right);
		Merge(a, left, mid, right);
	}
	return;
}

int main()
{
	int n, a[500000];
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	MergeSort(a, 0, n);
	for(int i = 0; i < n; i++){
		cout << a[i];
		if(i == n - 1) cout << endl;
		else cout << " ";
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 5060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
const ll INF=1e18+7;
const ll MOD=1e9+7;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a,b;
	cin >> a >> b;
	if((a*b)&1)cout << "Yes" << endl;
	else cout << "No" << endl;	
}


Measured memory_bytes: 256
M,D=[int(thing) for thing in input().split(" ")]
ret=0
for i in range(D):
    d=i+1
    d_10,d_1=divmod(d,10)
    if d_10<2 or d_1<2:
        continue
    product=int(d_10*d_1)
    if product<=M:
        ret=ret+1
print(ret)

Measured memory_bytes: 3060
from collections import Counter
n,k=map(int,input().split())
lst=list(map(int,input().split()))
new_lst=[]
result=0
if len(list(set(lst)))<=k:
    print(result)
    exit()
else:
    c=Counter(lst).most_common()
    for u in range(k,len(c)):
        new_lst.append(c[u][1])
    print(sum(new_lst))

Measured memory_bytes: 48436
#include<bits/stdc++.h>
#include<cstring>
using namespace std;
#define num 1000000007
//#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define up(a,b) (((a)%(b)==0)?((a)/(b)):((a)/(b))+1)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) (a>b)?(a>c)?a:c:(b>c)?b:c
#define min3(a,b,c) (a<b)?(a<c)?a:c:(b<c)?b:c
#define avg(a,b) ((a)+(b))/2
#define push push_back
#define pop pop_back
#define mp make_pair
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
typedef long long ll;

ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll gcd(ll a, ll b)
{
    if(b==0)
    {
        return a;
    }
    return gcd(b, a%b);
}
bool prime[3001];
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=3000; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=3000; i += p) 
                prime[i] = false; 
        } 
    } 
}
ll powe[20];
void power()
{
	powe[0]=1;
	REP(i,1,20)
	{
		powe[i]=(powe[i-1]*10)%num;
        if(powe[i]<0)
        powe[i]+=num;
	}
}
struct vertex
{
	vll adj;
};
void dfs(ll i,vertex V[], bool vis[], ll dist[])
{
	vis[i]=true;
	//cout<<i<<" ke liye\n";
	for(auto x : V[i].adj)
	{
		if(!vis[x])
		{
			dfs(x,V,vis,dist);
		}
		dist[i]=max(dist[i],1+dist[x]);
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll h,w;
	string A[1005];
	cin>>h>>w;
	REP(i,0,h)
	{
		cin>>A[i];
	}
	ll dp[h][w];
	REP(i,0,h)
	{
		REP(j,0,w)
		{
			dp[i][j]=0;
		}
	}
	
	dp[0][0]=1;
	REP(i,0,h)
	{
		REP(j,0,w)
		{
			if(A[i][j]=='.')
			{
				if(i>0 && A[i-1][j]=='.')
				{
					dp[i][j]=(dp[i][j]+dp[i-1][j])%num;
				}
				if(j>0 && A[i][j-1]=='.')
				{
					dp[i][j]=(dp[i][j]+dp[i][j-1])%num;
				}
			}
		}
	}
	// REP(i,0,h)
	// {
	// 	REP(j,0,w)
	// 	{
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }
	cout<<dp[h-1][w-1]<<"\n";
	return 0;
}

Measured memory_bytes: 9088
#define _USE_MATH_DEFINES
 
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
 
#include <bits/stdc++.h> 
 
using namespace std;
 
#define len(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define vi vector<int> 
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<int, int>
#define beg begin
 
#ifdef LOCAL
    #define dbg(x) cout << #x << " = " << x << endl;
#else 
    #define dbg(x)
#endif 
 
template<class T> istream& operator>>(istream &str, vector<T> &a) {
	for (auto &i : a) {
		str >> i; 
	}
	return str;
}
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);                                       
    freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    solve();    
}
 
const int INF = 1e18, MAXN = 3e5 + 10, MOD = 1e9 + 7;

void solve() {
	int sum = 0;

	int n; cin >> n;
	vi a(n);
	cin >> a;

	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			sum += a[i] * a[j];
		}
	}

	cout << sum << endl;
}	

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> TUP;
#define a first
#define b second
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}

int main(){
	ll N,K; cin>>N>>K;
    vector<P> p(N);//おいしさ、種類
    map<ll,ll> m;//種類、個数
    rep(i,N){
        ll x,y; cin>>x>>y;
        p[i]=mp(y,x);
    }
    sort(p.bg,p.ed,greater<P>());
  
    ll point=0;//おいしさの合計
    rep(i,K){
        point+=p[i].a;

        auto itr=m.find(p[i].b);
        if(itr!=m.ed){
            (itr->b)++;
        }
        else{
            m.insert(mp(p[i].b,1));
        }
    }

    vector<ll> maxp(K+1,-1);
	maxp[m.size()]=point;

    //複数食いからまずいものへらす(p:K-1->0までに限る) k
    //0食いからおいしいもの増やす(p:K->N-1までに限る) h
    ll k=K-1,h=K;
    bool f=true;

    while(f && h<N && k>=0){
        for(ll i=k;i>=0;i--){
            auto itr=m.find(p[i].b);
            if(itr!=m.ed && (itr->b)>=2){
                (itr->b)--;
                k=i-1;
                point-=p[i].a;
                break;
            }
            if(i==0) f=false;
        }

        for(ll i=h;i<N;i++){
            auto itr=m.find(p[i].b);
            if(itr==m.ed){
                point+=p[i].a;
                m.insert(mp(p[i].b,1));
                h=i+1;
                break;
            }
            if(i==N-1) f=false;
        }
    
        if(f) maxp[m.size()]=point;
    }

    ll ans=0;
    rep1(i,K){
        if(maxp[i]!=-1 && ans<maxp[i]+i*i){
            ans=maxp[i]+i*i;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6528
import java.util.*;
import java.io.*;

class Main {

    public static void main(String[] args) {

	final Scanner stdin = new Scanner(System.in);

	final int T = Integer.parseInt( stdin.nextLine() );
	for ( int t = 0; t < T; t++ ) {
	    
	    final String input = stdin.nextLine();
	    for ( int j = 0; j < 26; j++ ) {
		for ( int i = 0; i < 26; i++ ) {
		    final String transInput = next( input, i, j );
		    //System.err.println( transInput );
		    if ( transInput.contains( "that" ) || transInput.contains( "this" ) ) {
			System.out.println( transInput );
			break;
		    }								
		}
	    }
	}	
    }

    static String next( String input, int alpha, int beta ) {
	char[] ar = input.toCharArray();
	for ( int i = 0; i < ar.length; i++ ) {
	    if ( 'a' <= ar[i] && ar[i] <= 'z' ) {
		ar[i] = ( char )( ( ( ar[i] - 'a') * alpha + beta ) % 26 + 'a' );
	    }
	}
	return new String( ar );
    }    
}

Measured memory_bytes: 23204
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2330

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

typedef long long ll;

int main()
{
	ll N;
	cin >> N;
	
	int cnt=0;
	for(ll i=1; i<N; i*=3){
		cnt++;
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1000003 ;

int main(){
  int n,k;
  cin >> n >> k;
  pair<ll,ll> p[n];
  rep(i,n)cin >> p[i].first >> p[i].second;
  ll ans=5*longinf;
  rep(i1,n){
    rep(i2,n){
      rep(j1,n){
        rep(j2,n){
          int cnt=0;
          rep(x,n){
            if(p[x].first>=p[i1].first && p[x].first<=p[i2].first && p[x].second>=p[j1].second && p[x].second<=p[j2].second)cnt++;
          }
          if(cnt>=k){
            ans=min(ans,abs(p[i1].first-p[i2].first)*abs(p[j1].second-p[j2].second));
          }
        }
      }
    }
  }
  cout << ans << endl;
return 0;}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 10000000000000007ll;

const double eps = 1e-10;

struct less_key {
    bool operator() (const pair<i64, i64>& p1, const pair<i64, i64>& p2)  const {
        return p1.first < p2.first;
    }
};

const i64 MAXN = 300005;

i64 n, k, s;
i64 a[MAXN];

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n >> k >> s;

    for (i64 i = 1; i <= k; i++) {
        a[i] = s;
    }
    for (i64 i = k + 1; i <= n; i++) {
        a[i] = s == 1000000000 ? 1 : 1000000000;
    }

    for (i64 i = 1; i <= n; i++) {
        cout << a[i] << " ";
    }

    return 0;
}

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

typedef long long ll;

int main(){ 
    ll a,b;
    cin >> a >> b;
    ll c(1),i(0);
    while(c<b){
        c--;
        c += a;
        i++;
    }
    cout << i << endl;

    return 0;
}

Measured memory_bytes: 3612
n= int(input())
ans=0
s=list(input())

G=s.count('G') 
R=s.count('R')
B=s.count('B')

ans= G*R*B

if n<=2:
	print(0)
else:
	for i in range(n-2):
		for j in range(min(i+1,n-2-i)):
			if s[i+1]!=s[i-j] and s[i+1]!=s[i+2+j] and s[i-j]!=s[i+2+j]:
				ans-=1
	print(ans)

Measured memory_bytes: 9176
n = int(input())
ary = list(map(int,input().split()))
ary = [ary[i] for i in range(n) if ary[i]%2 == 0]
c = 0
while not len(ary) < n:
    ary = [ary[i]//2 for i in range(n) if ary[i]//2%2 == 0 ]
    c += 1
print(c)

Measured memory_bytes: 3060