akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define llong long long
#define mkpr make_pair
#define x first
#define y second
#define iter iterator
#define riter reversed_iterator
#define y1 Lorem_ipsum_
#define tm dolor_sit_amet_
using namespace std;

inline int read()
{
	int x = 0,f = 1; char ch = getchar();
	for(;!isdigit(ch);ch=getchar()) {if(ch=='-') f = -1;}
	for(; isdigit(ch);ch=getchar()) {x = x*10+ch-48;}
	return x*f;
}

const int mxN = 1e5;
const int INF = 1e9;
int n,m,s;

int main()
{
	n = read(),m = read(),s = read();
	for(int i=1; i<=m; i++) printf("%d ",s);
	for(int i=m+1; i<=n; i++) printf("%d ",s==INF?s-1:s+1);
	return 0;
}

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

int main() {
 
  ll n;
  cin >> n;
  
  ll arr[n],c=0;
  
  for(ll i=0;i<n;i++) {
    cin >> arr[i];
    if(arr[i]-1!=i)
      c++;
  }
  
  if(c<=2)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  
  return 0; 
  
}

Measured memory_bytes: 256
a,b,c,d=map(int,input().split())
onef=c//b
if c%b == 0 :
  if a-d*(onef-1) <= 0:
    print('No')
  else:
    print('Yes')
else:
  if a-d*(onef) <= 0:
    print('No')
  else:
    print('Yes')

Measured memory_bytes: 9176
#include<stdio.h>
#include<string.h> 
int main()
{
	int N;
	double r;
	scanf("%d", &N);
	
	if(N%2==0) r = 1.00 / 2.00;
	else r = ((N+1)/2) / (double)N;
	
	printf("%f", r);

	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;


int buff[100];
int top = -1;
int n = 3;

void push(int n)
{
	buff[++top] = n;
}
int pop()
{
	return buff[top--];
}

int main(void)
{
	char s[1000001];
	int a, b;

	while (scanf("%s", s) != EOF) {
		switch (s[0]) {
		case '+':
			a = pop();
			b = pop();
			push(a + b);
			break;
		case '-':
			a = pop();
			b = pop();
			push(b - a);
			break;
		case '*':
			a = pop();
			b = pop();
			push(a * b);
			break;
		default:
			push(atoi(s));
		}
	}

	printf("%d\n", buff[0]);
	return 0;
}


Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
unordered_map<ll, int>cnt;
int g2;
ll calc (int *a) {
	ll ans = 0; g2 = 0;
	for (int i = 0; i < 4; ++i) {
		ll tmp = 0;
		for (int j = 0; j < 4; ++j) tmp = tmp << 10 | a[(i + j) & 3];
		if (tmp > ans) ans = tmp, g2 = 1;
		else if (tmp == ans) ++g2;
	}
	return ans;
}

const int N = 404;

int p[N][4], n, tt[4];
ll a[4], ans, v;

int main () {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < 4; ++j) scanf("%d", &p[i][j]), ++p[i][j];
		++cnt[calc(p[i])];
	}
	for (int i = 0; i < n; ++i) {
		
		for (int j = i + 1; j < n; ++j) {
			
			--cnt[calc(p[i])]; --cnt[calc(p[j])];
			
			for (int k = 0; k < 4; ++k) {
				
				v = 1;
				for (int t = 0; t < 4; ++t) {
					tt[0] = p[i][(t + 1) & 3];
					tt[1] = p[i][t];
					tt[2] = p[j][(k + 5 - t) & 3];
					tt[3] = p[j][(k - t + 4) & 3];
					a[t] = calc(tt);
					v *= g2;
				}
				
				for (int t = 0; t < 4; ++t) v *= cnt[a[t]]--;
				
				for (int t = 0; t < 4; ++t) ++cnt[a[t]];
				
				ans += v;
				
			}
			
			++cnt[calc(p[i])]; ++cnt[calc(p[j])];
		}
	}
	printf("%lld\n", ans / 3);
	return 0;
}

Measured memory_bytes: 58256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int X;
    cin >> X;
    int MAX = 101010;
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (int i = 2; i < MAX; ++i) {
        if (!is_prime[i]) continue;
        for (int j = i*2; j < MAX; j += i) is_prime[j] = 0;
    }
    int i = X;
    while(1) {
        if(is_prime[i]==1) break;
        else i++;
    }
    cout << i << endl;
    return 0;
}


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

public class Main {
  private static String solve(char[] cs) {
    boolean[] exists = new boolean[26];
    for (char c : cs) {
      exists[c - 'a'] = true;
    }
    for (int i = 0; i < 26; i++) {
      if (!exists[i]) {
        return "" + (char)('a' + i);
      }
    }
    return "None";
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    char[] cs = reader.nextCharArray();
    out.println(solve(cs));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 22484
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll ZERO = 0;
const int Inf = 1000000000;
const ll INF= 1e18;
const ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

int main() {
    int N;
    cin >> N;
    map<int,int> ma;
    for(int i = 0;i < N;i++) {
        int A;
        cin >> A;
        ma[A]++;
    }
    bool ret = true;
    for(auto x:ma) {
        if(x.second >= 2) {
            ret = false;
        }
    }
    if(ret == true) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 9600
#include <iostream>
#include <cmath>
#include <utility>

using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
#define mp make_pair
#define x first
#define y second

int main () {
	int n,a,b;
	cin>>n;
	cin>>a>>b;
	int tr=0;
	for(int i=a;i<=b;i++){
		if(i%n==0) tr=1;
	}
	if(tr) cout<<"OK";
	else cout<<"NG";
	



return 0;
}

Measured memory_bytes: 3596
'use strict';
        (function(stdin) {
            for(var j = 1; j <= 9; j ++)
                for(var i = 1; i <= 9; i ++)
            console.log(j + 'x' + i + '=' + i * j);
    }(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 7640
a[100],i,k,m,t;main(n){while(scanf("%d%d",&n,&m),n|m){for(i=0;i<n*m;scanf("%d",&t),a[i++%m]+=t);n=m;while(n--){for(t=i=0;i<m;++i)t=t<a[i]?a[k=i]:t;printf("%d%c",k+1,n?32:10),t=a[k]=0;}}}

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

int main() {
  int a, b ;
  cin >> a >> b ;
  
  int X = (a * b) % 2 ;
  
  if (X == 1)
    cout << "Odd" << endl;
  else
    cout << "Even" << endl;

}
  
  

    
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fo(i,n)         for(int i=0;i<n;i++)
#define Fo(i,k,n)       for(int i=k;i<n;i++) 
#define endl            "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vec(x)          vector<x>
#define matrix(x)       vector<vector<x>>
#define mem(a,b)        memset(a, b, sizeof a)
#define vii             vector<pair<int,int>>
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define MOD             998244353
#define deb(x)          cerr <<#x<<" = "<<x<<"\n"
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define rep(i,a,b)      for (int i = a; i<b; ++i)
#define len(s)          s.length()
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
int power(int a,int b,int m=mod)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}

void angshuGod()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

const int N = 1e5+1;
const double pi = acos(-1);

void solve(){    

    int n,k;
    cin>>n>>k;

    int ans = 0;
    for(int i = k;i<=n+1;i++){
        int minsum = i*(i-1)/2;
        int mxsum = (2*n-i+1)*i/2;
        ans = (ans + (mxsum-minsum+1))%mod;
    }
    cout<<ans;
}

 
int32_t main()
{
    angshuGod();

    int t;

    t = 1;
    //cin>>t;

    while(t--){
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 3632
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K = map(int, readline().split())

    if K > (N - 1) * (N - 2) // 2:
        print('-1')
        return
        
    m = (N - 1) * (N - 2) // 2 - K
    M = N - 1 + m
    
    print(M)
    for i in range(2, N+1):
        print(1, i)
    
    i, j = 2, 3
    for _ in range(m):
        print(i, j)
        if j == N:
            i += 1
            j = i + 1
        else:
            j += 1

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9128
#include<bits/stdc++.h>
using namespace std ;
#define ll long long int 
#define pb push_back 
#define mp make_pair 
#define pii pair <int , int > 
#define pll pair < ll , ll >
int main(){
	ios_base::sync_with_stdio(false) ;
	cin.tie(NULL) ;
	string s ;
  	cin >> s ;
  	for(int i = 0 ; i < 3 ; i++){
      if(s[i] == s[i + 1]){
        cout << "Bad" ;
        return 0 ;
      }
    }
  cout << "Good" ;
}

Measured memory_bytes: 256
// pre-order, in-order and post-order
#include<iostream>
typedef struct{
  int p, l, r;
}tree;
void preorder(int);
void inorder(int);
void postorder(int);
tree *T;
int main(){
  int n, i, x, root=0;
  std::cin>>n;
  T=new tree[n];
  for(i=0; i<n; i++) T[i].p = -1;
  for(i=0; i<n; i++){
    std::cin>>x;
    std::cin>>T[x].l>>T[x].r;
    T[T[x].l].p = T[T[x].r].p = x;
  }
  for(i=0; i<n; i++){
    if(T[i].p == -1){
      root = i;
      break;
    }
  }
  std::cout<<"Preorder\n";
  preorder(root);
  std::cout<<"\nInorder\n";
  inorder(root);
  std::cout<<"\nPostorder\n";
  postorder(root);
  std::cout<<std::endl;
  delete T;
  return 0;
}
void preorder(int x){
  if(x == -1) return;
  std::cout<<" "<<x;
    preorder(T[x].l);
    preorder(T[x].r);
}
void inorder(int x){
  if(x == -1) return;
    inorder(T[x].l);
    std::cout<<" "<<x;
    inorder(T[x].r);
}
void postorder(int x){
  if(x == -1) return;
    postorder(T[x].l);
    postorder(T[x].r);
    std::cout<<" "<<x;
}

Measured memory_bytes: 3108
using System.Text;
using System.Linq;
using System;
using System.IO;

class Program
{
  static void Main(string[] args)
  {
    var seq = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    var a = seq[0];
    var b = seq[1];

    var cnt = 0;
    for(int i = a; i <= b; i++)
    {
      var sf = i.ToString();
      var sr = string.Join("", sf.Reverse());
      if(sf == sr) cnt++;
    }
    Console.WriteLine(cnt);
  }
}

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

int main() {
	// your code goes here
	int n;cin>>n;
	int a[n+1];for(int i=0;i<n;i++)cin>>a[i];
	int count=0;
	int mini=INT_MAX;
	for(int i=0;i<n;i++)
	{
	    if(mini>a[i])
	    {
	        mini=a[i];
	        count++;
	    }
	}
	cout<<count;
	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(void){
	int arr[2],i,max,min;
	scanf("%d%d%d",&arr[0],&arr[1],&arr[2]);
	max=arr[0];
	for(i=0;i<=2;i++)if(arr[i]>=max)max=arr[i];
	min=arr[2];
	for(i=2;i>=0;i--)if(arr[i]<=min)min=arr[i];
	printf("%d\n",max-min);
	return 0;
}

Measured memory_bytes: 128
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		ArrayList<Integer> one = nextIntArray();
		int N = one.get(0);
		int K = one.get(1);
		long output = 0;
		for(int i = 1; i <= N; i++){
			output += Math.max(0, i - K) * (N / i) + Math.max(0, N % i - K + 1);
		}
		if(K == 0){
			output -= N;
		}
		myout(output);
	}
	//Method addition frame start



	//Method addition frame end
}


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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define Pi 1
#define LL long long
#define ULL unsigned long long
#define LD long double

using namespace std;

int main()
{
  string S;
  cin >> S;
  if(S.find("YAKI") == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 764
func main(input1: String = readLine()!, input2: String = readLine()!) {
    let integers = input2.split(separator: " ").map { Int($0)! }
    
    let mod = 1000000007
    var summary = 0
    for i in integers {
        summary += i
        summary %= mod
    }
    var result = 0
    for i in integers {
        summary -= i
        if summary < 0 {
            summary += mod
        }
        result += i * summary
        result %= mod
    }
    print(result)
}

main()

Measured memory_bytes: 21292
#include<bits/stdc++.h>
using namespace std;
const int INF = 1 << 28;

int main()
{
  int N;
  int graph[200][200];
  fill_n(*graph, 200 * 200, INF);
  for(int i = 0; i < 200; i++) graph[i][i] = 0;

  cin >> N;
  while(N--) {
    int u, d;
    string type;
    cin >> u >> type >> d;
    --u, --d;
    if(type == "lock") graph[100 + d][u] = -1;
    else graph[u][100 + d] = -1;
  }
  for(int k = 0; k < 200; k++) {
    for(int i = 0; i < 200; i++) {
      for(int j = 0; j < 200; j++) {
        graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j]);
      }
    }
  }
  bool flag = false;
  for(int i = 0; i < 200; i++) {
    flag |= graph[i][i] < 0;
  }
  cout << flag << endl;
}

Measured memory_bytes: 1364
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    int[][] D;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.D= new int[N][2];
        for (int i = 0; i < N; i++) {
        	for (int j = 0; j < 2; j++) {
        		this.D[i][j] = sc.nextInt();
        	}
        }
    }
    
    //解答処理
    private String solve() {
        String answer = "No";
        
        for (int i = 0; i < N-2; i++) {
        	if (D[i][0] == D[i][1] && D[i+1][0] == D[i+1][1] && D[i+2][0] == D[i+2][1]) {
        		answer = "Yes";
        		break;
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

}


Measured memory_bytes: 36084
#include<stdio.h>

int main(){
  
  int i;
  int a,x,y;
  
  scanf("%d%d",&x, &y);
  
  for(i = 0; i < x+1; i++){
    
    a = 2*i + 4*(x - i);
    
    if(a == y){
      printf("Yes\n");
      return 0;
    }
  }
  
  printf("No\n");
  return 0;
        
}

Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
using namespace std;
long long b[100010];
int main(){
    long long i,n,h,ans,mx = 0,a;
    cin >> n >> h;
    for(i=0;i<n;i++){
        cin >> a >> b[i];
        mx = max(a,mx);
    }
    sort(b,b+n);
    ans = (h + mx - 1)/mx;
    for(i=0;i<n;i++){
        h -= b[n-1-i];
        if(h<=0){
            ans = min(ans,i+1);
            break;
        }
        ans = min(ans,i + 1 + (h + mx - 1)/mx);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
n,x = map(int, input().split())

if x == 1 or x==2*n-1:
    print('No')
else:
    print('Yes')
    l = [i for i in range(1,2*n)]
    l.remove(x-1)
    l.remove(x)
    l.remove(x+1)
    j=0
    for i in range(n-2):
        print(l[i])
    print(x-1)
    print(x)
    print(x+1)
    for i in range(n-2):
        print(l[n-2+i])


Measured memory_bytes: 52592
#include <stdio.h>

int main() {
	int S,h,m,s;
	scanf("%d", &S);

	h = S / 3600;
	m = S % 3600 / 60;
	s = S % 3600 % 60;

	printf("%d:%d:%d\n", h,m,s);

	return 0;
}



Measured memory_bytes: 2092
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

h,w = inpl()
cnt = defaultdict(int)
for _ in range(h):
    for x in input():
        cnt[x] += 1
one = two = 0
for va in cnt.values():
    now = va%4
    if now == 1 or now == 3:
        one += 1
    if now == 2 or now == 3:
        two += 1
res = False
if h%2 == 0 and w%2 == 0:
    if not one and not two:
        res = True
elif h%2 and w%2:
    if one == 1 and two <= (w-1)//2 + (h-1)//2:
        res = True
else:
    now = h if w%2 else w
    if not one and two <= now//2:
        res = True
print('Yes' if res else 'No')

Measured memory_bytes: 10420
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>
#include <numeric>
#include <iomanip>

using namespace std;
int C[16];
int x[20000];
int dp[20000][256];
int main(void){
  int N;
  int M;
  while(true){
    cin >> N >> M;
    if(N == 0 && M == 0){
      break;
    }
    for(int i = 0; i < M; i++){
      cin >> C[i];
    }
    for(int i = 0; i < N; i++){
      cin >> x[i];
    }

    for(int i = 0; i < N; i++){
      for(int j = 0; j < 256; j++){
        dp[i][j] = INT_MAX;
      }
    }

    for(int i = 0; i < M; i++){
      int next_y = max(0, min(C[i] + 128, 255));
      dp[0][next_y] = min(dp[0][next_y], (next_y - x[0]) * (next_y - x[0]));
    }
    for(int i = 0; i < N - 1; i++){
      for(int j = 0; j < 256; j++){
        if(dp[i][j] != INT_MAX){
          for(int k = 0; k < M; k++){
            int next_y = max(0, min(C[k] + j, 255));
            dp[i + 1][next_y] = min(dp[i + 1][next_y], dp[i][j] + (next_y - x[i + 1]) * (next_y - x[i + 1]));
          }
        }
      }
    }
    int ans = INT_MAX;
    for(int i = 0; i < 256; i++){
      ans = min(ans, dp[N - 1][i]);
    }
    cout << ans << endl;
    }
  return 0;
}



Measured memory_bytes: 23056
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
#define forn(i,n) for(ll i=0;i<ll(n);++i)
#define all(x) (x).begin(),(x).end()
#define eb emplace_back
#define pb push_back
#define fst first
#define snd second

const int N = 200100;
ll xs[N];

int main() {
    int n;
    scanf("%d", &n);
    forn(i, n) scanf("%lld", xs+i), xs[i] -= i;
    sort(xs, xs+n);
    ll tail = 0;
    forn(i, n) tail += xs[i] - xs[0];
    ll best = tail;
    ll head = 0;
    for (int i = 1; i < n; ++i) {
        ll d = xs[i] - xs[i-1];
        tail -= d * (n - i);
        head += d * i;
        best = min(best, head + tail);
    }
    printf("%lld\n", best);
}


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

using namespace std;

struct Dinic {
    using F = int; const static F INF = 0x3f3f3f3f; 
    //using F = long long; const static F INF = 0x3f3f3f3f3f3f3f3f; 
    struct Edge {
        int v, bro; F cap;
        Edge() {}
        Edge(int _v, int _bro, F _cap) : v(_v), bro(_bro), cap(_cap) {}
    };
    vector<Edge> e;
    vector<int> pos, cur;
    int n, s, t, m;
    Dinic(int _n, int _s, int _t) : n(_n), s(_s), t(_t), m(0) {
        pos.assign(n, -1);
        cur.resize(n);
        d.resize(n);
        e.reserve(4e5);
    }
    void add(int u, int v, F c=INF) {
        assert(u < n && v < n);
        e.emplace_back(v, pos[u], c); pos[u] = m++;
        e.emplace_back(u, pos[v], 0); pos[v] = m++;
    }
    vector<int> d;
    // build layer graph
    bool bfs() {
        fill(d.begin(), d.end(), -1);
        d[s] = 0;
        queue<int> q; q.push(s);
        while (!q.empty()) {
            int u = q.front(); q.pop();
            for (int i = cur[u] = pos[u]; i != -1; i = e[i].bro) {
                int v = e[i].v;
                if (d[v] == -1 && e[i].cap != 0) {
                    d[v] = d[u] + 1;
                    q.push(v);
                }
            }
        }
        return d[t] != -1;
    }
    // find blocking flow
    F dfs(int u, F lim) {
        if (u == t) return lim;
        F tot = 0;
        for (int& i = cur[u]; i != -1; i = e[i].bro) {
            int v = e[i].v;
            if (e[i].cap != 0 && d[v] == d[u] + 1) {
                F flow = dfs(v, min(e[i].cap, lim-tot));
                tot += flow;
                e[i].cap -= flow;
                e[i^1].cap += flow;
                if (tot == lim) return lim;
            }
        }
        return tot;
    }
    F flow() {
        F res = 0;
        while (bfs()) {
            res += dfs(s, INF);
        }
        return res;
    }
};

void solve() {
    int n, m;
    cin >> n >> m;
    vector<string> s(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    pair<int, int> Sp, Tp;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (s[i][j] == 'S') Sp = {i,j};
            if (s[i][j] == 'T') Tp = {i,j};
        }
    }
    if (Sp.first == Tp.first || Sp.second == Tp.second) {
        cout << -1; return;
    }

    int S = n+m, T = S+1;
    Dinic mc(T+1, S, T);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (s[i][j] == 'o') {
                mc.add(i, n+j, 1);
                mc.add(n+j, i, 1);
            }
            if (s[i][j] == 'S') {
                mc.add(S, i);
                mc.add(S, n+j);
            }
            if (s[i][j] == 'T') {
                mc.add(i, T);
                mc.add(n+j, T);
            }
        }
    }
    cout << mc.flow();
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a,b;
	cin>>n>>a>>b;
	if(n==1 && (a!=b))
		cout<<"0\n";
	else if(a>b)
		cout<<"0\n";
	else
	{
		long long ans=1ll*(n-1)*b+a;
		long long ans1=1ll*(n-1)*a+b;
		cout<<ans-ans1+1ll<<endl;
	} 
	return 0;
}  

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static long MAX = 1000000000;
	static char[] f;
	static int pos;
	static int T;

	public static void main(String[] args) {
		int N = sc.nextInt();
		T = sc.nextInt();
		f = sc.next().toCharArray();
		ArrayList<Term> poly = new ArrayList<Term>();
		while (pos < f.length) {
			poly.add(parse());
			++pos;
		}
		long ans = 0;
		for (Term t : poly) {
			ans += t.eval(N);
		}
		if (ans > MAX) {
			System.out.println("TLE");
		} else {
			System.out.println(ans);
		}
	}

	static Term parse() {
		pos += 2;
		int p = f[pos++] - '0';
		return new Term(p);
	}

	static class Term {
		int p;

		Term(int p) {
			this.p = p;
		}

		long eval(int n) {
			long ret = T;
			for (int i = 0; i < p; ++i) {
				ret *= n;
				if (ret > MAX) return MAX + 1;
			}
			return ret;
		}
	}

}

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

using namespace std;

#define ll  long long
#define ld long double
#define f first
#define s second
#define matrix vector<vector<char>>
#define zero(n,m) matrix(n , vector<char>(m,'0'))
#define one(n,m) matrix(n , vector<ll>(m,1))
#define pii pair<int,int>
#define point complex<ld>
#define angle(a) (atan2((a).imag() , (a).real() ))
#define pi acos(-1)
#define X real()
#define Y imag()
const int N = 1e5+5;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ll n , ans=0;
    cin >> n;
    for(ll i=1; i<=n; i++)
    {
        for(ll j=1; i*j<=n; j++)
        {
            if (i*j < n) ans++;
        }
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<static_cast<int>(n);++i)
#define per(i, n) for(int i=static_cast<int>(n)-1;i>=0;--i)
#define eee(a) (cerr<<"[@"<<__LINE__<<"] "<<(#a)<<": "<<(a)<<'\n');
#define ppp(a) (cout<<(a)<<'\n'); 
#define cop(a) for(auto x:(a)){cerr<<(x)<<'\n';}
using ll = long long;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
constexpr ll MOD = 1e9+7;
constexpr ll Mod = 998244353;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr double phi = (1+sqrt(5))/2;
constexpr double pi = 3.14159265358979323846264338327950288;
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll inverse(ll n,ll m=MOD){ll a=n,b=m,x=1,y=0;while(b){ll t=a/b;a-=t*b;swap(a,b);x-=t*y;swap(x,y);}return (a%m+m)%m;}
inline void Yes(){puts("Yes");}
inline void No(){puts("No");}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){puts("YES");}
inline void NO(){puts("NO");}
inline void JUDGE(bool b){b?YES():NO();}
inline ll powmod(ll b, ll e, ll m=MOD){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
inline double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
inline double d2r(double d){return d*pi/180;}
inline double r2d(double r){return r*180/pi;}
template<class T>inline bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
template<typename T>inline int bs(int g,int k,T c){while(abs(k-g)>1){int m=(g+k)/2;(c(m)?k:g)=m;}return k;}
template<typename T1,typename T2>ostream& operator<<(ostream& s,const pair<T1, T2>& p){return s <<"("<<p.first<<", "<<p.second<<")";}
template<typename T> ostream& operator<<(ostream& s,const vector<T>& v){s<<'[';for(size_t i=0;i<v.size();++i){s<<v[i];if(i<v.size()-1)s<<", ";}s<<']';return s;}
template<typename T> istream& operator>>(istream& s,vector<T>& v){for(T& x:v)s>>x;return s;}


int main(){
    cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    
    int n, m;
    cin >> n >> m;
    vector<int> mark(n, -1);
    vector<vector<int>> G(n);
    for(int i = 0; i < m; ++i){
        int a, b;
        cin >> a >> b;
        --a; --b;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }

    queue<pair<int, int>> q;
    q.emplace(0, -1);
    while(!q.empty()){
        auto [i, par] = q.front(); q.pop();
        if(mark[i] > 0) continue;
        mark[i] = par+1;
        for(auto nx : G[i]){
            if(nx != par) q.emplace(nx, i);
        }
    }

    cout << "Yes" << '\n';
    for(int i = 1; i < n; ++i){
        cout << mark[i] << '\n';
    }
    
    
    return 0;
}


Measured memory_bytes: 11296
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  int n;
  cin >> n;
  int res = 0;
  int ak = 0;
  int ost = -1;
  R(i,n){
    int pom;
    cin >> pom;
    if(pom <= ost){
      ak++;
    }else{
      ak = 0;
    }
    maxi(res,ak);
    ost = pom;
  }
  cout << res << "\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
int main() {
	int n, m;
	while (cin >> n >> m, n) {
		int c[16];
		rep(i, m) {
			cin >> c[i];
		}
		ll x[20001];
		rep1(i, n) {
			cin >> x[i];
		}
		ll dp[20001][256];
		rep(j, 256) {
			rep(i, 20001) {
				dp[i][j] = INF;
			}
		}
		dp[0][128] = 0;
		rep1(i, n) {
			rep(k, m) {
				rep(j, 256) {
					int r = j + c[k];
					if (r < 0)r = 0;
					if (r > 255)r = 255;
					dp[i][r] = min(dp[i][r],dp[i - 1][j]+(ll)(r-x[i])*(r-x[i]));
				}
			}
		}
		ll out=INF;
		rep(i, 256) {
			out = min(out, dp[n][i]);
		}
		cout << out << endl;
	}
	return 0;
}


Measured memory_bytes: 43192
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P;
map<int, int> dp;
#define REP(i, n) for (int i = 0; i < n; i++)
struct restaurant {
  restaurant() = default;
  ~restaurant() = default;
  restaurant(string name_i, int point_i, int place_i)
      : name(name_i), point(point_i), place(place_i){};
  string name;
  int point;
  int place;
};
bool cmp(const restaurant &a, const restaurant &b) {
  if (a.name != b.name) {
    return a.name < b.name;
  } else {
    return a.point > b.point;
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<restaurant> SP(N);
  REP(i, N) {
    cin >> SP[i].name >> SP[i].point;
    SP[i].place = i+1;
  }

  sort(SP.begin(), SP.end(), cmp);
  for (auto &tmp : SP) {
    cout << tmp.place << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int main(){
  int ans;
  for(int i = 0; i < 3; i++){
    char c;
    cin >> c;
    if(c == '1'){
      ans += 9*pow(10,2-i);
    }else if(c == '9'){
      ans += 1*pow(10,2-i);
    }
  }
  cout << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    ll ans = 0;
    map<ll, ll> mp;
    rep(i, n) {
        cin >> a[i];
        mp[a[i]]++;
        ans += a[i];
    }
    int q;
    cin >> q;
    rep(i, q) {
        ll b, c;
        cin >> b >> c;
        ans = ans - mp[b]*b + mp[b]*c;
        mp[c] += mp[b];
        mp[b] = 0;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 9476
n,m=map(int,raw_input().split())
a=[list(raw_input().strip()) for _ in xrange(n)]
z=[[0]*(m+1) for _ in xrange(n+1)]
z[0][1]=1
for i in xrange(n):
    for j in xrange(m):
        if a[i][j]=='.':
            z[i+1][j+1]+=z[i+1][j]+z[i][j+1]
print z[-1][-1]%(pow(10,9)+7)

Measured memory_bytes: 164740
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
    vector<char> N(4);
    rep(i, 4) cin >> N.at(i);
    sort(all(N));
    string S = "";
    rep(i, 4) S += N.at(i);
    cout << (S == "1479" ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
b = []
c = []
for i in range(N):
    if i<N//2:
        b.append(-1)
    else:
        b.append(a[i])

for i in reversed(range(N//2)):
    t = 1
    s = 0
    while (i+1)*(t+1)<=N:
        s+=b[(i+1)*(t+1)-1]
        t+=1
    if s%2 != a[i]:
        b[i]=1
    else:
        b[i]= 0
#print(b)

bo = False
for j in range(N):
    if b[j]==1:
        bo = True
        c.append(str(j+1))
if bo:
    print(len(c))
    print(" ".join(c))
else:
    print(0)

Measured memory_bytes: 105040
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main(){
	string X;
	cin >> X;
	int N = X.length();
	int i, j;
	int p = 0;
	int q = 0;
	for (i = 0; i < N; i++){
		if (p == 0 && X[i] == 'T'){
			continue;
		}
		else if (X[i] == 'S'){
			p++;
		}
		else if (X[i] == 'T'){
			p--;
			q++;
		}
	}
	cout << N - 2 * q << endl;
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define clr(x) memset(x, 0, sizeof(x))
#define sz(x) (int)x.size()

using namespace std;

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

const ll mx = 105;
const ll maxn = 1000001;
const ll mod = 1000000007;

vector<vector<int>> adj;
vector<ll> lis;
bool vis[maxn];
bool pos;

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

  ll t = 1;

  //cin>>t;

  while(t--){
    
     ll n, i, j, k;

     cin>>n>>k;

     ll res = 0, mi = 0, ma = 0;


     for(i = k;i <= n + 1;i++){

         mi = (i-1)*i/2;
         ma = n*(n+1)/2 - (n-i >= 0 ?(n-i)*(n-i+1)/2:0);
      //   cout<<mi<<" "<<ma<<"\n";
         ll cur = ma-mi+1;
         res = (res%mod + cur%mod)%mod ;
     }
     cout<<res<<"\n";
  }     
        
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int dp[100001];
vector<int> num;
int main(){
    int n;
    cin>>n;
    rep(i,n+1) dp[i]=1000100010;
    num.pb(1);
    int x=1;
    while(x*6<=n){
        x*=6;
        num.pb(x);
    }
    x=1;
    while(x*9<=n){
        x*=9;
        num.pb(x);
    }
    int sz=num.size();
    dp[0]=0;
    rep(i,n+1)if(dp[i]!=1000100010)rep(j,sz){
        if(i+num[j]<=n) dp[i+num[j]]=min(dp[i+num[j]],dp[i]+1);
    }
    cout<<dp[n]<<endl;
    return 0;
}

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

int main(){
  int n;

  for(;;){
    cin >> n;
    if ( n == 0 ) break;

    double scores[1000] ={}, sum = 0;
    double m = 0, sigma = 0, stddev = 0;

    for (int i=0; i<n; i++){
      cin >> scores[i];
      sum += scores[i];
    }
    m = sum / n;

    for ( int i=0; i<n; i++){
      sigma += pow(scores[i] - m, 2);
    }
    stddev = sqrt(sigma/n);

    printf("%lf\n", stddev);
  }

  return 0;
}

Measured memory_bytes: 3204
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNext()) {
			int dataSet = scanner.nextInt();
			if (dataSet == 0) {
				break;
			}
			int[] scoreArray = new int[dataSet];
			for (int i = 0; i < dataSet; i++) {
				scoreArray[i] = scanner.nextInt();
			}
			Arrays.sort(scoreArray);
			int sum = 0;
			for (int i = 1; i < scoreArray.length - 1; i++) {
				sum += scoreArray[i];
			}
			System.out.println(sum / (dataSet - 2));
		}
	}
}

Measured memory_bytes: 20948
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iomanip>
#include <map>
#include <queue>
#include <list>


#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
//#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define INF 1e9
#define vint vector<int>

using namespace std;
typedef long long  ll;

//const long long M = 1e9+7;
int ctoi(const char c){
    switch(c){
        case '0': return 0;
        case '1': return 1;
        case '2': return 2;
        case '3': return 3;
        case '4': return 4;
        case '5': return 5;
        case '6': return 6;
        case '7': return 7;
        case '8': return 8;
        case '9': return 9;
        default : return -1;
    }
}

int main()
{
    string s;
    cin >> s;
    ll n = 0;
    vector<ll> count(s.size()+1);
    char c;
    int cand = 1;
    for(int i = s.size() - 1; i >= 0; i--){
        //        n = stoll(s.substr(s.size() - i, i));
//        c = s[i];
        n = (s[i]-'0') * cand % 2019;
//        p(n);
//        p2(s.substr(s.size() - i, i), n%2019);
        count[i] = (count[i+1] + n) % 2019;
        cand *= 10;
        cand %= 2019;
    }


    vector<ll> tmp(2019);
    ll ans = 0;
    for(int i = s.size(); i >= 0; i--){
        ans += tmp[count[i]];
        tmp[count[i]]++;
    }


    p(ans);
}


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

// macros
#define overload_rep(_1, _2 ,_3 ,name, ...) name
#define re_p(i, n) for(int i = 0; i < (n); ++i)
#define r_ep(i, x, y) for(int i = (x); i < (y); ++i)
#define rep(...) overload_rep(__VA_ARGS__, r_ep, re_p,)(__VA_ARGS__)
#define all(a) a.begin(), a.end()
#ifndef STOP_DEBUG
#define debug(...)\
    do{ cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_cerr(__VA_ARGS__); cerr << noboolalpha; } while (0)
#else
#define debug(...)
#endif

// functions
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; }
void debug_cerr(){ cerr << '\n'; }
template<class Head, class... Tail>
void debug_cerr(Head head, Tail... tail){
    cerr << ' ' << head;
    debug_cerr(tail...);
}

// cin/cout setup
struct IoSetup{
    IoSetup(){
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << setprecision(20);
    }
} iosetup;

// AtCoder Grand Contest 039
int main(){

    string s;
    int k;
    cin >> s >> k;

    int n = (int)s.size();
    string t = s.back() + s;
    vector<int> vec1(n, 0);
    vector<int> vec2(n + 1, 0);

    long long cnt1 = 0, cnt2 = 0;
    rep(i, n - 1){
        if(s[i] == s[i + 1]){
            cnt1++;
            vec1[++i]++;
        }
    }
    rep(i, n){
        if(t[i] == t[i + 1]){
            cnt2++;
            vec2[++i]++;
        }
    }

    long long ans = 0;
    if(vec1.back()){
        ans += cnt1 * k;
    } else {
        if(vec2.back()){
            ans += (cnt1 + cnt2) * (k / 2);
            if(k % 2 == 1)ans += cnt1;
        } else {
            ans += cnt1 + cnt2 * (k - 1);
        }
    }

    cout << ans << endl;
    
}

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

int main()
{
  int N;
  std::vector<int64_t> L;
  
  std::cin>>N;
  if(N<=2)
  {
    std::cout<<0<<std::endl;
    return 0;
  }
  
  L.reserve(N);
  for(int i=0;i!=N;i++)
  {
    std::cin>>L.emplace_back();
  }
  
  int i=0,j=1,k=2;
  int result=0;
  for(;;)
  {
    if(L[i]!=L[j]&&L[j]!=L[k]&&L[k]!=L[i])
    {
      if(L[i]+L[j]>L[k]&&L[j]+L[k]>L[i]&&L[k]+L[i]>L[j])
      {
        result++;
      }
    }
    
    k++;
    if(k==N)
    {
      j++;
      k=j+1;
    }
    if(j==N-1)
    {
      i++;
      j=i+1;
      k=j+1;
    }
    if(i==N-2)
    {
      break;
    }
  }
  
  std::cout<<result<<std::endl;
  
  return 0;
}

Measured memory_bytes: 3628
#include<iostream>
using namespace std;
#define ll long long

void solve(int** dp,int i,int j,int *r,int& dc,int v) {
	//printf("%d %d\n",i,j);
	if(i==0) {
		r[dc++]=j;
		return;
	}
	for(int k=-1;k<=1;k++)
		if(j+k>=0 && j+k<10)
			if(dp[i-1][j+k]>=v) {
				r[dc++]=j;
				solve(dp,i-1,j+k,r,dc,v);
				break;
			}
			else v-=dp[i-1][j+k];
}

int main() {
	int a;
	scanf("%d",&a);
	int **dp = new int*[10];
	for(int i=0;i<10;i++) dp[i] = new int[10];
	for(int i=0;i<10;i++) dp[0][i]=1;
	for(int i=1;i<10;i++) {
		for(int j=0;j<10;j++) {
			dp[i][j]=0;
			if(j>0) dp[i][j]+=dp[i-1][j-1];
			dp[i][j]+=dp[i-1][j];
			if(j<9) dp[i][j]+=dp[i-1][j+1];
		}
	}
	int prev=0,dc=0;
	int r[10];
	bool fl=true;
	for(int i=0;i<10&&fl;i++) {
		for(int j=1;j<10&&fl;j++) {
			if(prev+dp[i][j]>=a) {
				solve(dp,i,j,r,dc,a-prev);
				fl=false;
			}
			else prev += dp[i][j];
		}
	}
	for(int i=0;i<dc;i++) printf("%d",r[i]);
}


Measured memory_bytes: 256
N=int(input())
A=[]
PRECISION_DIGITS=9
cnt={}


for n in range(N):
	tmpA = float(input())
	tmpA = round(tmpA*10**PRECISION_DIGITS)
	#print(tmpA)

	five = 0
	two = 0
	while (tmpA % 2) == 0:
		two += 1
		tmpA //= 2
	while (tmpA % 5) == 0:
		five += 1
		tmpA //= 5

	# (10**9) -> (two,five)=(9,9)
	two -= PRECISION_DIGITS
	five -= PRECISION_DIGITS

	if (two,five) in cnt:
		cnt[(two,five)]+=1
	else:
		cnt[(two,five)]=1

# print(cnt)
ans = 0
for t1, cnt1 in cnt.items():
	for t2, cnt2 in cnt.items():
		# 2**a(a>=0) and 5**b(b>=0) => integer
		if 0 <= t1[0]+t2[0] and 0 <= t1[1]+t2[1]:
			if t1 < t2:
				ans += int(cnt1*cnt2)
			elif t1 == t2:
				# same entry
				# Total number of combinations choose 2 items
				# nC2 = n*(n-1)/2
				ans += int((cnt1*(cnt2-1))/2)


print(ans)



Measured memory_bytes: 74828
#include <bits/stdc++.h>
using namespace std;
int main () {
    int K;
    cin >> K;
    long long ans = 0;
    for (int i = 1; i <= K; i++) {
        for (int j = 1; j <= K; j++) {
            for (int k = 1; k <= K; k++) {
                ans += gcd(gcd(i, j), k);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636