akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
  int n,m,q;
  bool switches[1000][36],bulbes[1000][1000],cand[36][1000];
  while(cin>>n>>m>>q,n){
    for(int i=0;i<q;i++){
      string s;
      cin>>s;
      for(int j=0;j<n;j++){
	switches[i][j]=s[j]-'0';
	if(i!=0) switches[i][j]^=switches[i-1][j];
      }
      string b;
      cin>>b;
      for(int j=0;j<m;j++)
	bulbes[i][j]=b[j]-'0';
    }
    for(int i=0;i<n;i++)
      for(int j=0;j<m;j++)
	cand[i][j]=1;
    for(int i=0;i<q;i++)
      for(int j=0;j<n;j++)
	for(int k=0;k<m;k++)
	  cand[j][k]&=switches[i][j]==bulbes[i][k];
    for(int i=0;i<m;i++){
      int index=-1,cnt=0;
      for(int j=0;j<n;j++)
	if(cand[j][i]){
	  index=j; cnt++;
	}
      if(cnt>1) cout<<"?";
      else if(index<10) cout<<index;
      else cout<<(char)(index-10+'A');
    }
    cout<<endl;
  }
}


Measured memory_bytes: 2256
#include <iostream>
#include <string>

using namespace std;
typedef long long ll;

int main(){
    string s;
    getline(cin, s);
    if(s.at(0) != 'A'){
        cout << "WA" << endl;
        return 0;
    }

    int large_c = 0;
    for(int i = 2; i <= s.size() - 2; ++i){
        large_c += (s.at(i) == 'C');
    }
    if(large_c != 1){
        cout << "WA" << endl;
        return 0;
    }

    for(int i = 1; i < s.size(); ++i){
        char c = s.at(i);
        if(c != 'C' && !((c >= 97 && c <= 122))){
            cout << "WA" << endl;
            return 0;
        }
    }

    cout << "AC" << endl;

    return 0;
}


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

using namespace std;

struct Block {
    int a, b, x;
    friend istream& operator>>(istream& in, Block& block) {
        int s, t;
        in >> s >> t >> block.x;
        block.a = 2*s-1-2*block.x;
        block.b = 2*t-1-2*block.x;
        return in;
    }
};

bool first_start(const Block& b1, const Block& b2) {
    return make_tuple(b1.a, b1.b, b1.x) < make_tuple(b2.a, b2.b, b2.x);
}

bool first_end(const Block& b1, const Block& b2) {
    return make_tuple(b1.b, b1.a, b1.x) < make_tuple(b2.b, b2.a, b2.x);
}

bool first_x(const Block& b1, const Block& b2) {
    return make_tuple(b1.x, b1.a, b1.b) < make_tuple(b2.x, b2.a, b2.b);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    vector<Block> blocks(n);
    for (auto& block : blocks) {
        cin >> block;
    }
    set<Block, function<bool (const Block&, const Block&)>> blocks_by_a(first_start);
    set<Block, function<bool (const Block&, const Block&)>> blocks_by_b(first_end);
    set<Block, function<bool (const Block&, const Block&)>> blocks_by_x(first_x);
    blocks_by_a.insert(blocks.begin(), blocks.end());
    while (q --> 0) {
        int d;
        cin >> d;
        d *= 2;
        while (blocks_by_a.size() > 0 && blocks_by_a.begin()->a < d) {
            blocks_by_b.insert(*blocks_by_a.begin());
            blocks_by_x.insert(*blocks_by_a.begin());
            blocks_by_a.erase(blocks_by_a.begin());
        }
        while (blocks_by_b.size() > 0 && blocks_by_b.begin()->b < d) {
            blocks_by_x.erase(*blocks_by_b.begin());
            blocks_by_b.erase(blocks_by_b.begin());
        }
        if (blocks_by_x.size() == 0) {
            cout << -1 << "\n";
        } else {
            cout << blocks_by_x.begin()->x << "\n";
        }
    }
    return 0;
}


Measured memory_bytes: 28672
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
    int fivehundred = n/500;
    int five = (n % 500) / 5;
    System.out.println(fivehundred*1000+five*5);
    //HashMap<String,Integer> map = new HashMap<String,Integer>();
    //LinkedList<String> array = new LinkedList<String>();
    //int max = 1;
    /*
    for(int i = 0; i < n; i++){
      String s = sc.next();
      int tmp = 1;
      if(map.containsKey(s)){
        tmp = map.get(s)+1;
      }
      map.put(s, tmp);
      
      if(tmp == max){
        array.add(s);
      } 
      else if(tmp > max){
        max = tmp;
        array.clear();
        array.add(s);
      }
    }
    */
    //array.sort(Comparator.naturalOrder());
    //for(String value : array)
	//{
      //System.out.println(value);
	//}
  }
}

Measured memory_bytes: 23764
from math import gcd
import itertools
k = int(input())
 
result = 0
 
# 3つとも等しい数字
for i in range(1, k+1):
    result += i
 
# 2つが等しくて、1つが異なる数字
for set in list(itertools.combinations(range(1, k+1), 2)):
    result += (gcd(set[0], set[1]))*6
 
# 3つとも異なる
for set in list(itertools.combinations(range(1, k+1), 3)):
    result += (gcd(gcd(set[0], set[1]), set[2]))*6
 
print(result)

Measured memory_bytes: 102484
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;

int main() {

	int n, k, d[200], a[200][200];
	cin >> n >> k;
	for (int i = 0; i < k; i++) {
		cin >> d[i];
		for (int j = 0; j < d[i]; j++) {
			cin >> a[i][j];
		}
	}
	int is_okashi[200];
	for (int i = 0; i < n; i++) {
		is_okashi[i] = 1;
	}

	for (int i = 0; i < k; i++) {
		for (int j = 0; j < d[i]; j++) {
			is_okashi[a[i][j]-1]=0;
		}
	}

	int ans = 0;
	for (int i = 0; i < n; i++) {
		ans += is_okashi[i];
	}

	cout << ans << endl;


	return 0;


}

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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define FOR(i,m,n) for(int i=(m) ; i<(n) ; i++)
#define FORR(i,m,n) for(int i=(m) ; i>=(n) ; i--)

typedef long long ll;
typedef unsigned long long ull;

const int INF = 1000000000;

int main(){
   string s,t;
   cin >> s >> t;
   for(int i=0;i<(int)s.size();i++){
      if(s == t){
         cout << "Yes" << endl;
         return 0;
      }else{
         s = s.back() + s.substr(0,s.size()-1);
      }
   }
   cout << "No" << endl;
   return 0;
}


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

int main()
{
    string s;
    cin >> s;
    if(s[0] == s[1] && s[2] == s[3] && s[0] != s[3])cout << "Yes";
    else if(s[0] == s[3] && s[1] == s[2] && s[0] != s[1])cout << "Yes";
    else if(s[0] == s[2] && s[1] == s[3] && s[0] != s[1])cout << "Yes";
    else cout << "No";
    cout << endl;
    return 0;
}

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

using namespace std;
using ll = long long;

int const NMAX = 3000 + 5;
ll const  INF  = 1e16;

ll n, m, k, dp[NMAX][NMAX][4], v[NMAX][NMAX];

ll solve(void)
{
    for (int c = 1; c <= m; ++c)
        fill(dp[0][c], dp[0][c] + 4, -INF);
    for (int r = 1; r <= n; ++r)
        fill(dp[r][0], dp[r][0] + 4, -INF);

    fill(dp[1][0], dp[1][0] + 4, 0);
    fill(dp[0][1], dp[0][1] + 4, 0);

    for (int r = 1; r <= n; ++r)
    {
        for (int c = 1; c <= m; ++c)
        {
            for (int cap = 0; cap <= 3; ++cap)
            {
                auto &ans = dp[r][c][cap];

                ans = max(dp[r - 1][c][3], dp[r][c - 1][cap]);
                if (cap > 0)
                {
                    ans = max({ans,
                               dp[r - 1][c][3] + v[r][c],
                               dp[r][c - 1][cap - 1] + v[r][c]});
                }
            }
        }
    }
    return *max_element(dp[n][m], dp[n][m] + 4);
}

int main(void)
{
    int ri, ci;
    cin >> n >> m >> k;
    for (int i = 1; i <= k; ++i)
    {
        cin >> ri >> ci;
        cin >> v[ri][ci];
    }

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 355808
// finish date: 2018/02/16

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000
#define pii pair<int,int>

//dijkstra(開始ノード、ノード数、edge[頂点名][距離、行先の頂点])
vi dijkstra(int s, int V, vector<vector<pii>> edge) {
    vi dist(V, INF); //INFの値がこれでいいか確認するべき
    vb used(V, false);
    priority_queue<pii, vector<pii >, greater<pii>> pq;
    pq.push(pii(0, s));
    while (!pq.empty()) {
        int d, t;
        tie(d, t) = pq.top();
        pq.pop();
        if (used[t]) continue;
        used[t] = true;
        dist[t] = d;
        for (pii e:edge[t]) {
            if (dist[e.second] < d + e.first) continue;
            pq.push(pii(d + e.first, e.second));
        }
    }
    return dist;
}

int main() {
    int N;
    cin >> N;
    vector<vector<pii>> edge(N);
    rep(i, N - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        edge[a].push_back(make_pair(1, b));
        edge[b].push_back(make_pair(1, a));
    }
    vi dis1 = dijkstra(0, N, edge);
    vi dis2 = dijkstra(N - 1, N, edge);
    int point1 = 0, point2 = 0;
    FOR(i, 1, N - 1) {
        if (dis1[i] <= dis2[i]) point1++;
        else point2++;
    }
//    point1 += (N - (point1 + point2 + 2) + 1) / 2;
//    point2 += (N - (point1 + point2 + 2)) / 2;
    if (point1 > point2) cout << "Fennec" << endl;
    else cout << "Snuke" << endl;

    return 0;
}




Measured memory_bytes: 12976
use std::collections::HashMap;

fn read_line() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).expect("No Line");
    buffer
}
fn read_lines<R, T: Fn(&str)->R> (count: usize, transformer: T) -> Vec<R> {
    let mut buffer = String::new();
    let mut vec = Vec::with_capacity(count);
    for _ in 0 .. count {
        std::io::stdin().read_line(&mut buffer).expect("No Line");
        vec.push(transformer(buffer.trim()));
    }
    vec
}
fn read_value<T: std::str::FromStr>() -> T {
    read_line().trim().parse().ok().unwrap()
}
fn read_values<T: std::str::FromStr>() -> Vec<T> {
    read_line().trim().split(' ').map(|x| x.parse().ok().expect("Can't Parse")).collect::<Vec<T>>()
}
fn read_tabulate<T: std::str::FromStr>(count: usize) -> Vec<T> {
    let mut buffer = String::new();
    let mut vec = Vec::with_capacity(count);
    for _ in 0 .. count {
        std::io::stdin().read_line(&mut buffer).expect("No Line");
        vec.push(buffer.parse().ok().expect("Can't Parse"));
    }
    vec
}
macro_rules! assign {
    () => {};
    ($($token:tt)*) => {
        let mut iter = read_values::<String>().into_iter();
        assign_iter!(iter, $($token)*);
    };
}
macro_rules! assign_iter {
    ($iter:expr) =>{};
    ($iter:expr,) =>{};
    ($iter:expr, $id:ident:$t:tt $($tail:tt)*) => {
        let $id: $t = $iter.next().unwrap().parse().ok().expect("Can't Parse");
        assign_iter!($iter, $($tail)*);
    };
    ($iter:expr, mut $id:ident:$t:tt $($tail:tt)*) => {
        let mut $id: $t = $iter.next().unwrap().parse().ok().expect("Can't Parse");
        assign_iter!($iter, $($tail)*)
    };
}
macro_rules! freeze {
    ($($id:ident), *) => {
        $(let $id = $id;)*
    };
}
fn main() {
    let mut map = HashMap::new();
    assign! {
        n: usize
    }
    for _ in 0 .. n {
        let value = map.entry(String::from(read_line().trim())).or_insert(0);
        *value += 1;
    }
    let state = vec!["AC", "WA", "TLE", "RE"];
    for s in state {
        println!("{} x {}", s, map.get(s).unwrap_or(&0));
    }
}

Measured memory_bytes: 2164
#include<iostream>
using namespace std;
int main (){

  int a[5],cnt[3];

  while(1){

    cin >>a[0];
    
    if(a[0] == 0)break;

    for(int i=1 ; i < 5 ; i++)cin >>a[i];
    
    for(int i=0 ; i < 3 ; i++)cnt[i]=0;

    for(int i=0 ; i < 5 ; i++)cnt[a[i]-1]++;
    
    if((cnt[0] > 0 && cnt[1] > 0 && cnt[2] > 0)||cnt[0] == 5 || cnt[1] == 5 || cnt[2] == 5){
      
      for(int i=0 ; i < 5 ; i++)cout <<"3"<< endl;
    
    }else if(cnt[0] == 0){
      
      for(int i=0 ; i < 5 ; i++){
	if(a[i] == 2){
	  cout <<"1"<<endl;
	}else{
	  cout <<"2"<<endl;
	}
      }

    }else if(cnt[1] == 0){

      for(int i=0 ; i < 5 ; i++){
	if(a[i] == 3){
	  cout <<"1"<<endl;
	}else{
	  cout <<"2"<<endl;
	}
      }

    }else{

      for(int i=0 ; i < 5 ; i++){
	if(a[i] == 1){
	  cout <<"1"<<endl;
	}else{
	  cout <<"2"<<endl;
	}
      }
      
    }

  }
  return 0;
}

Measured memory_bytes: 1156
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		boolean[] abc = {true,false,false};
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			String[] st = sc.nextLine().split(",");
			int a = alphabetChangeToInt(st[0]);
			int b = alphabetChangeToInt(st[1]);
			boolean tmp = abc[a];
			abc[a] = abc[b];
			abc[b] = tmp;
		}
		for(int i = 0 ; i < 3 ; i++){
			if(abc[i]){
				System.out.println(intToAlphabet(i));
				break;
			}
		}
		sc.close();
	}
	
	public static int alphabetChangeToInt(String st){
		if(st.equals("A")){
			return 0;
		}else if(st.equals("B")){
			return 1;
		}else if(st.equals("C")){
			return 2;
		}
		return -1;
	}
	
	public static String intToAlphabet(int n){
		if(n == 0){
			return "A";
		}else if(n == 1){
			return "B";
		}else if(n == 2){
			return "C";
		}
		return null;
	}
}

Measured memory_bytes: 17164
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)

vector<vector<vector<ll>>> dp(55, vector<vector<ll>>(2600, vector<ll>(55, 0)));
int main() {
    int n, a; cin >> n >> a;
    vector<int> X(n);
    rep(i, n) cin >> X[i];

    
    ll sum = 0; dp[0][0][0] = 1;
    
    rep(i, n){
        rep(j, 2501){
            rep(k, i+1){
                dp[i+1][j+X[i]][k+1] += dp[i][j][k];
                dp[i+1][j][k] += dp[i][j][k];
            }
        }
    }
    rep(i, 2501){
        for(int k = 1; k <= 50; k++){
            if(i / (double)k == a){;
                sum +=  dp[n][i][k];             
            }
        }
    }
    cout << sum << ln;
}




Measured memory_bytes: 67456
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main(){
  int r,c,ans;
  ans = 0;
  cin >> r >> c;
  int sx,sy,gx,gy;
  sx = 1;
  sy = 1;
  gx = c;
  gy = r;
  map<int,string> map;
  vector<vector<int>> v(r+2,vector<int>(c+2,0));
  string wall = "";
  rep(i,c+2) wall+="#";
  map[0] = wall;
  rep(i,r){
    string s;
    cin >> s;
    rep(j,c){
      if(s.at(j)=='.') ans++;
    }
    s = "#" + s + "#";
    map[i+1] = s;
  }
  map[r+1] = wall;
  int turn = -1;
  int nx,ny;
  int mkr=0;
  nx=sx;
  ny=sy;
  vector<int> x = {1,0,-1,0};
  std::vector<int> y = {0,1,0,-1};
  queue<P> q;
  set<int> st;
  P p(nx,ny);
  q.push(p);
  while(true){
    turn+=1;
    queue<P> Q;
    while(q.size()>0){
      nx = q.front().first;
      ny = q.front().second;
      if(nx == gx && ny == gy){
        mkr=1;
        break;
      }
      q.pop();
      for(int i=0; i<4; i++){
        if(map[ny+y[i]].at(nx+x[i])=='.' && v[ny+y[i]][nx+x[i]]==0){
          P p(nx+x[i],ny+y[i]);
          v[ny+y[i]][nx+x[i]] = 1;
          Q.push(p);
        }
      }
    }
    if(mkr==1){
      break;
    }
    else if(Q.size()==0){
      ans=turn;
      break;
    }
    q=Q;
  }
  cout << ans - turn - 1 << endl;
}

Measured memory_bytes: 3628
n = int(input())
m = int(n * (n-1) / 2)
score = list(0 for i in range(n))
for i in range(m) :
    team1, team2, score1, score2 = map(int, input().split())
    if score1 == score2 :
        score[team1 - 1] += 1
        score[team2 - 1] += 1
    elif score1 > score2 :
        score[team1 - 1] += 3
    else :
        score[team2 - 1] += 3

sorted_score = sorted(score, reverse=True)
for i in range(n) :
    print(sorted_score.index(score[i])+1)

    



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

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i, n) cin >> p[i];

  sort(p.begin(), p.end());
  int ans=0;
  rep(i, k) ans += p[i];
  cout << ans << endl;
  return 0;
}

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

using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using pii = pair<int,int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back

int main() {
  int x;
  for(int i=1;i<=5;i++) {
    cin>>x;
    if(!x) cout<<i<<endl;
  }
}


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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var D = input[0];
            var N = input[1];
            var tmp = 0;
            if (D == 0) tmp = 1;
            else if (D == 1) tmp = 100;
            else if (D == 2) tmp = 10000;
            var ans = 0;
            if (N == 100)
            {
                ans = tmp * (N + 1);
            }else
            {
                ans = tmp * N;
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13268
q, h, s, d = map(int, input().split())
n = int(input())

#2Lあたりの金額の最小値
x = min(q * 8, h * 4, s * 2, d)
#1Lあたりの金額の最小値
y = min(q * 4, h * 2, s)

if n == 1:
    print(y)
else:
    if n % 2 == 0:
        print(x * (n // 2))
    else:
        print(x * (n // 2) + y)



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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;

int main() {
    int r;
    cin >> r;
    cout << 3 * r * r << endl;
}


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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)
#define Float(x) OUTN(fixed, setprecision(x));

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// IN
void IN() {}
template <class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

// OUTS
void OUTS() {}
template <class Head, class... Tail>
void OUTS(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  OUTS(forward<Tail>(tail)...);
}

template <class T>
void OUTS(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void OUTS(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// OUTL
void OUTL() {}
template <class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

template <class T>
void OUTL(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// OUTN
void OUTN() {}
template <class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}

template <class T>
void OUTN(vector<T> &vec) { for (auto &e : vec) cout << e; }
// }}} End

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int cnt[10]{};
  rep(i, 4) {
    VAR(int, n);
    cnt[n]++;
  }
  OUTL((cnt[1] && cnt[9] && cnt[7] && cnt[4]) ? "YES" : "NO");
  return 0;
}


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

#define ll long long int
#define str string
#define ALL(a)  (a).begin(),(a).end()
#define P pair<ll,ll>

using Graph = vector<vector<int>>;

const int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
ll INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Min = INFL, Max = -1;
ll a, b, c ,n, sum, A[500010], B[500000],rui[500000],  dp[5000];
str S;bool check = true;	vector<ll> v;



int main() {
	//Code Line
cin >> S;

if(S[0] == 'S' && S[1] == 'U')cout << 7 << endl;
else if(S[0] == 'M' )cout << 6 << endl;
else if(S[0] == 'T' && S[1] == 'U')cout << 5 << endl;
else if(S[0] == 'W' )cout << 4 << endl;
else if(S[0] == 'T' && S[1] == 'H')cout << 3 << endl;
else if(S[0] == 'F')cout << 2 << endl;
else if(S[0] == 'S' && S[1] == 'A')cout << 1<< endl;


	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int n, i;
    cin >> n;
    int a[n];//配列変数を宣言するときはnを定数にする。



    for(i=0;i<n;i++){
            cin >> a[i];
    }

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

    cout << a[0] << endl;

}



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


int main(){
  string S;
  cin >> S;
  string ans;
  if(S=="AAA") ans = "No";
  if(S=="BAA") ans = "Yes";
  if(S=="ABA") ans = "Yes";
  if(S=="AAB") ans = "Yes";
  if(S=="BBA") ans = "Yes";
  if(S=="BAB") ans = "Yes";
  if(S=="ABB") ans = "Yes";
  if(S=="BBB") ans = "No";
  cout << ans << endl;
}

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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;


int main(){
  int r;
  cin>>r;
  cout << 2*3.14159265*r << endl;
  return 0;
}




Measured memory_bytes: 3788
n = int(input())
a = list(map(int, input().split()))

start = 1
i = 0
while i < n:
    if a[i] == start:
        start += 1
        i += 1
    else:
        i += 1

start -= 1

if start == 0:
    print(-1)
else:
    print(n-start)

Measured memory_bytes: 26268
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define ff first
#define ss second
#define p pair<int,int>
#define pb push_back
#define endl '\n'
#define w(t) ll test;cin>>test;while(test--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define pi acos(-1)
const int mxn=1e9+5;
int main()
{
    fast;
    int x;
    cin>>x;
    cout<<(x>=30?"Yes":"No")<<endl;
}



Measured memory_bytes: 3648
#include <iostream>

using namespace std;

int main() {
  int num = 0;
  string s;
  cin >> s;
  for (int i = 0; i < 4; i++) {
    if (s[i] == '+') {
      num++;
    } else {
      num--;
    }
  }
  cout << num << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
double v1,v2,t,x,x2;
int a[10],i;
while(scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%lf,%lf",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5],&a[6],&a[7],&a[8],&a[9],&v1,&v2)!=EOF){
x=0;
x2=0;
for(i=0;i<10;i++){
x+=a[i];
}
t=(double)x/((double)v1+(double)v2)*(double)v1;
for(i=0;i<10;i++){
x2+=a[i];
if(x2>=t){
printf("%d\n",i+1);
break;
}
}
}
return 0;
}

Measured memory_bytes: 1052
import java.util.Scanner;
public class Main{
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();


		if(a == b) {
			System.out.println("Draw");
			System.exit(0);
		}
		if(a == 1 && b <= 13 && 2 <= b) {
			System.out.println("Alice");
			System.exit(0);
		}
		if(b == 1 && a <= 13 && 2 <= a) {
			System.out.println("Bob");
			System.exit(0);
		}
		if(a > b) {
			System.out.println("Alice");
		}else {
			System.out.println("Bob");
		}
	}
}

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

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using Pint = pair<int, int>;
const ll mod = 1e9+7;

int dp[101][4][2];

int main(int argc, char const* argv[])
{
  string s;
  cin>>s;
  int n = s.size();
  int K;
  cin>>K;

  dp[0][0][0] = 1;
  REP(i,n)REP(j,K+1)REP(k,2) {
    int nd = s[i] - '0';
    REP(d,10) {
      int ni=i+1, nj=j, nk=k;
      if(d<nd) nk=1;
      if(k==0) {
        if(nk==0 && d!=nd) continue;
        if(nk==1 && d>=nd) continue;
      }
      if(d) nj++;
      if(nj>K) continue;
      dp[ni][nj][nk] += dp[i][j][k];
      // printf("d:%d, dp[%d][%d][%d]: %d -> dp[%d][%d][%d]: %d, nd:%d\n",d,i,j,k,dp[i][j][k],ni,nj,nk,dp[ni][nj][nk],nd);
    }
    // printf("\n");
  }

  int ans = dp[n][K][0] + dp[n][K][1];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<": "<<x<<endl;
#define N 300005
#define M 1000000007
#define pii pair<ll,ll>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
const int D=1000001;
int mp[D];
vector<int>dv[D];
main()
{
    int n;
    cin>>n;
    for(int i=1;i<D;i++)
    {
        for(int j=i;j<D;j+=i)
        {
            dv[j].push_back(i);
        }
    }
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        mp[a[i]]++;
    }
    int ans=0;
    for(int i=0;i<n;i++)
    {
        mp[a[i]]--;
        bool f=true;
        for(int u:dv[a[i]])
        {
            if(mp[u])
                f=false;
        }
        mp[a[i]]++;
        if(f)
        {
            ans++;
            //cout<<a[i]<<endl;
        }
    }
    cout<<ans;
}



Measured memory_bytes: 122464
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <string>
#include <utility>
#include <map> 
#include <queue>
#include <stack>
#include <iomanip>
#include <sstream>
#define MP make_pair
#define PB push_back
#define SZ size()
#define B begin()
#define E end()
#define ll long long
#define REP(i,a,n) for(ll i=a; i<n; ++i)
#define RED(i,n,a) for(ll i=n; i>=a; --i)
#define m9 1000000007
#define endl "\n"
#define F first
#define S second
#define ld long double
#define eps 0.00000000001
#define MAX 1000000007
#define vll vector <ll> 
#define pll pair <ll,ll> 

using namespace std;

ll gcd(ll a, ll b){
    if(a%b==0){
        return b;
    }
    else{
        return gcd(b, a%b);
    }
}
ll powc(ll a, ll b){
    if(b<0){
        return -1;
    }
    ll res=1;
    while(b>0){
        if(b&1){
            res*=a;
        }
        a*=a;
        //res%=m9, a%=m9;
        b>>=1;
    }
    return res;
}



///target expert

int main(){
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s, t; cin>>s>>t;
    ll ans= 1e9;
    REP(i,0,(ll)s.SZ){
        if(t.SZ+i>(ll)s.SZ){
            break;
        }
        ll temp=0;
        REP(j,i,i+(ll)t.SZ){
            if(s[j]!=t[j-i]){
                temp++;
            }
        }
        ans=min(ans,temp);
    }
    cout<<ans;
}



Measured memory_bytes: 3616
import qualified Data.ByteString.Char8 as B
import Data.Attoparsec.ByteString.Char8

main :: IO ()
main = do
  Right (n, as) <- parseOnly inputParser <$> B.getContents
  print $ solve n as

inputParser :: Parser (Int, [Int])
inputParser = (,)
  <$> decimal <* endOfLine
  <*> decimal `sepBy` space

solve :: Int -> [Int] -> Int
solve n as = sum as - n


Measured memory_bytes: 1660
#include <iostream>
#include <cstring>

using namespace std;

int dx[4],dy[4],ret=0;
int f[4][4];

void dfs(int depth){
    int x=-1,y=-1,nx,ny;

    if(depth == 8){
        ret++;
        return;
    }

    for(int i=0;i<4;i++){
        for(int j=0;j<4;j++){
            if(f[i][j] == 0){
                y = i;
                x = j;
                break;
            }
        }
        if(x >= 0) break;
    }
    f[y][x] = 1;
    for(int i=0;i<4;i++){
        ny = y + dy[i];
        nx = x + dx[i];
        if(0 <= nx && nx < 4 && 0 <= ny && ny < 4 && !f[ny][nx]){
            f[ny][nx] = 1;
            dfs(depth+1);
            f[ny][nx] = 0;
        }
    }
    f[y][x] = 0;
}

int main(){
    while(cin >> dx[0] >> dy[0]){
        memset(f, 0, sizeof(f));
        if(dx[0] > 4) break;
        ret=0;
        for(int i=1;i<4;i++){
            cin >> dx[i] >> dy[i];
        }
        dfs(0);
        cout << ret << endl;
    }
}

Measured memory_bytes: 0
#include <iostream>
#include <math.h>
using namespace std;

int Myprime(int x)
{
	for (int i = 2; i <= sqrt(x); i++)
		if (!(x % i)) return 0;
	return 1;
}

int main()
{
	int n, count = 0, x;
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> x;
		count += Myprime(x);
	}
	cout << count << "\n";
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll x, a, b;
	cin >> x >> a >> b;
	x -= a;
	x -= x / b * b;
	cout << x << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstring>

using namespace std;

int root[200000];
int getRoot(int v){ return root[v] == -1 ? v : root[v] = getRoot(root[v]); }

class Edge {
public:
	Edge(int p, int q, int c) : p(p), q(q), c(c) {}
	int p;
	int q;
	int c;
	bool operator < (const Edge& e) const { return c < e.c; }
};

int main(){
	int N, Q;
	while(cin >> N >> Q){
		vector<Edge> edge;
		priority_queue< pair<int,int>, vector< pair<int,int> >, greater< pair<int,int> > > qu;
		for(int i=0;i<Q;i++){
			int A, B, C; cin >> A >> B >> C;
			edge.emplace_back(Edge(A, B, C));
			qu.push(make_pair(C+1, A));
			qu.push(make_pair(C+2, B));
		}
		vector<int> checked(N, 0);
		while(!qu.empty()){
			pair<int, int> pr = qu.top(); qu.pop();
			int cost = pr.first;
			int idx = pr.second;
			if(checked[idx]) continue;
			edge.emplace_back(Edge(idx, (idx+1)%N, cost));
			qu.push(make_pair(cost+2, (idx+1)%N));
			checked[idx] = 1;
		}
		memset(root, -1, sizeof(root));
		long long res = 0;
		sort(edge.begin(), edge.end());
		for(int i=0;i<edge.size();++i){
			int p = getRoot(edge[i].p);
			int q = getRoot(edge[i].q);
			if(p != q){
				res += edge[i].c;
				root[q] = p;
			}
		}
		cout << res << endl;
	}
}



Measured memory_bytes: 10240
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>


#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

struct Robot {
	int64_t x;
	int64_t e;
	int64_t s;
};

constexpr int64_t kRem = 998244353;


template <class T>
class SegTree {
	size_t n;                       // 葉の数
	vector<T> data;              // データを格納するvector
	T def;                       // 初期値かつ単位元
	function<T(T, T)> operation; // 区間クエリで使う処理
	function<T(T, T)> update;    // 点更新で使う処理

	// 区間[a,b)の総和。ノードk=[l,r)に着目している。
	T _query(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l) return def; // 交差しない
		if (a <= l && r <= b)
			return data[k]; // a,l,r,bの順で完全に含まれる
		else {
			T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2); // 左の子
			T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r); // 右の子
			return operation(c1, c2);
		}
	}

public:
	// _n:必要サイズ, _def:初期値かつ単位元, _operation:クエリ関数,
	// _update:更新関数
	SegTree(size_t _n, T _def, function<T(T, T)> _operation,
		function<T(T, T)> _update)
		: def(_def), operation(_operation), update(_update) {
		n = 1;
		while (n < _n) {
			n *= 2;
		}
		data = vector<T>(2 * n - 1, def);
	}

	// 場所i(0-indexed)の値をxで更新
	void change(int i, T x) {
		i += n - 1;
		data[i] = update(data[i], x);
		while (i > 0) {
			i = (i - 1) / 2;
			data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
		}
	}

	// [a, b)の区間クエリを実行
	T query(int a, int b) {
		return _query(a, b, 0, 0, n);
	}

	// 添字でアクセス
	T operator[](int i) {
		return data[i + n - 1];
	}
};


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int n; cin >> n;
	vector<Robot> rs(n);
	for (auto& r : rs) {
		cin >> r.x;
		int64_t d; cin >> d;
		r.e = r.x + d;
	}
	sort(rs.begin(), rs.end(), [](const auto & lhs, const auto & rhs) {
		return lhs.x < rhs.x;
	});

	auto process = [](const int& prev, const int& next) {
		return max(prev, next);
	};
	auto update = [](const int& prev, const int& next) {
		return next;
	};
	SegTree<int> is(n, 0, process, update);
	FOR_DW(i, n - 1, 0) {
		Robot ref;
		ref.x = rs[i].e - 1;
		auto it = upper_bound(rs.begin(), rs.end(), ref, [](const auto & lhs, const auto & rhs) {
			return lhs.x < rhs.x;
		});
		it--;
		int ci = (it - rs.begin());

		int ni = 0;
		if (ci != i) {
			ni = is.query(i + 1, ci + 1);
		}
		else {
			ni = ci;
		}
		is.change(i, ni);
	}

	vector<int64_t> ss(n + 1);
	ss[n] = 1;
	FOR_DW(i, n - 1, 0) {
		ss[i] = ss[i + 1];
		ss[i] += ss[is[i] + 1];
		ss[i] %= kRem;
	}
	cout << ss[0] << endl;
}


Measured memory_bytes: 8576
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int a = sc.nextInt();
        if (h % a == 0) {
            System.out.println(h / a);
        } else {
            System.out.println(h / a + 1);
        }
    }

}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
	int k, q, i;
	scanf("%lld%lld", &k, &q);
	vector<int> d(k);
	for(i = 0; i < k; i++){
		scanf("%d", &d[i]);
	}
	while(q--){
		int n, x, m, ans = 0, s = 0, a_last;
		scanf("%lld%lld%lld", &n, &x, &m);
		x %= m;
		a_last = x;
		vector<int> d_mod_m(k);
		for(i = 0; i < k; i++){
			d_mod_m[i] = d[i] % m;
			s += d_mod_m[i];
		}
		for(i = 0; i < k; i++){
			if(d_mod_m[i] == 0){
				ans += (n - 1) / k + ((n - 1) % k > i ? 1 : 0);
			}
			a_last += d_mod_m[i] * ((n - 1) / k + ((n - 1) % k > i ? 1 : 0));
		}
//		printf("ans1 = %lld\n", ans);
//		printf("a_last = %lld\n", a_last);
		ans += a_last / m;
		printf("%lld\n", n - 1 - ans);
	}
	return 0;
}

Measured memory_bytes: 384
n = gets.to_i
counts = n.times.with_object(Hash.new(0)) do |_, h|
  s = gets.chomp[0]
  h[s] += 1
end

ans = %w(M A R C H).combination(3).inject(0) do |r, (a, b, c)|
  r + counts[a] * counts[b] * counts[c]
end

puts ans


Measured memory_bytes: 2044
#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main(void) {
  vector<int64_t> SIZE(4);
  int64_t N;
  cin >> SIZE[0] >> SIZE[1] >> SIZE[2] >> SIZE[3] >> N;

  int64_t answer = 0;
  vector<int64_t> QHSD(4);
  int times = 8;
  for (int j = 0; j < 4; ++j) {
    QHSD[j] = SIZE[j] * times;
    times /= 2;
  }
  sort(QHSD.begin(), QHSD.end());
  answer += QHSD[0] * (N / 2);
  if (N % 2 == 0) {
    cout << answer << endl;
    return 0;
  }

  vector<int64_t> QHS(3);
  times = 4;
  for (int j = 0; j < 3; ++j) {
    QHS[j] = SIZE[j] * times;
    times /= 2;
  }
  sort(QHS.begin(), QHS.end());
  answer += QHS[0];
  cout << answer << endl;
  return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;

typedef long long ll;

int N,K;
ll x1[110],y1[110],d1[110],x2[110],y2[110],d2[110];
vector<ll> x,y,z;
int num[110][110][110];
int xl,xr,yl,yr,zl,zr;

int main(){
  cin >> N >> K;
  rep(i,N){
    cin >> x1[i] >> y1[i] >> d1[i] >> x2[i] >> y2[i] >> d2[i];
    x.pb(x1[i]); x.pb(x2[i]);
    y.pb(y1[i]); y.pb(y2[i]);
    z.pb(d1[i]); z.pb(d2[i]);
  }

  sort(all(x)); sort(all(y)); sort(all(z));
  x.erase(unique(all(x)),x.end());
  y.erase(unique(all(y)),y.end());
  z.erase(unique(all(z)),z.end());

  rep(i,x.size())rep(j,y.size())rep(k,z.size())num[i][j][k] = 0;

  rep(a,N){
    xl = lower_bound(all(x),x1[a]) - x.begin();
    xr = lower_bound(all(x),x2[a]) - x.begin();
    yl = lower_bound(all(y),y1[a]) - y.begin();
    yr = lower_bound(all(y),y2[a]) - y.begin();
    zl = lower_bound(all(z),d1[a]) - z.begin();
    zr = lower_bound(all(z),d2[a]) - z.begin();
   
    for(int i=xl;i<xr;i++)
      for(int j=yl;j<yr;j++)
	for(int k=zl;k<zr;k++)num[i][j][k]++;
  }

  ll ans = 0;
  rep(i,x.size())rep(j,y.size())rep(k,z.size()){
    if(num[i][j][k]>=K){
      ans += (x[i+1]-x[i])*(y[j+1]-y[j])*(z[k+1]-z[k]);
    }
  }
  cout << ans << endl;
}

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

public class Main{
	static int INF=(int)1e9;

	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner();
		PrintWriter out=new PrintWriter(System.out);
		int n=sc.nextInt();
		int []h=new int [n];
		for(int i=0;i<n;i++)
			h[i]=sc.nextInt();
		int K=2;
		int []dp=new int [n];
		Arrays.fill(dp, INF);
		dp[n-1]=0;
		for(int i=n-2;i>=0;i--) {
			for(int j=1;j<=K && i+j<n;j++) {
				
				dp[i]=Math.min(dp[i], dp[i+j]+Math.abs(h[i]-h[i+j]));
				}
//			out.println(dp[i]);
		}
		
		out.println(dp[0]);
		
		out.close();

	}
	static class Scanner
	{
		BufferedReader br;
		StringTokenizer st;
		Scanner(){
			br=new BufferedReader(new InputStreamReader(System.in));
		}
		Scanner(String fileName) throws FileNotFoundException{
			br=new BufferedReader(new FileReader(fileName));
		}
		String next() throws IOException {
			while(st==null || !st.hasMoreTokens())
				st=new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		String nextLine() throws IOException {
			return br.readLine();
		}
		int nextInt() throws IOException{
			return Integer.parseInt(next());
		}
		long nextLong()  throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}
		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}
	}
}


Measured memory_bytes: 33652
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
    int N;
    cin >> N;
    int h[N];
    int cnt = 0;
    for (int i = 0; i < N; i++) cin >> h[i];
    for (int i = 0; i < N;) {
        if (h[i] > 0) {
            cnt++;
            for (int j = i; j < N; j++) {
                if (h[j] == 0) break;
                h[j]--;
                }
        } else {
            i++;
        }
    }
    cout << cnt << endl;
}


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

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define tll tuple<ll, ll, ll>
#define all(c) c.begin(),c.end()

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
 
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;

//command
//c++ atcoder.cpp -std=c++14
//./a.out

//fill(score, score+202020, 0);
#define NN 202020

int main(){
  ll n;
  cin >> n;
  
  cout << n*n << endl;
}


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

int N,x;
int a[110];

int main(){
    cin>>N>>x;

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

    sort(a,a+N);
    
    int sum = 0;
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        sum += a[i];

      if(sum>x || (i==N-1 && sum < x)) break;

        ans++;
    }
    
    cout << ans << endl;
    

    return 0;
}


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

int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	
	if(a<b && b<c){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	
	return 0;
}


Measured memory_bytes: 1972
<?php
    fscanf(STDIN, "%s", $s);
    switch($s){
        case 'Sunny':
        echo 'Cloudy';
        break;
        case 'Cloudy';
        echo 'Rainy';
        break;
        case 'Rainy';
        echo 'Sunny';
        break;
    }
  ?>

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

int main() {
  int n; string s;
  cin >> n;cin >> s;
  for(int i = 0; i < s.size(); i++){
    int temp = s[i] - 'A';
    temp = (temp + n) % 26;
    s[i] = temp + 'A';
    cout << s[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main (){
    int h,w;
    cin >> h >> w;
    string a[h];
    for(int i=0;i<h;i++){
        cin >> a[i];
    }
    int c[26]={0};
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            c[a[i][j]-'a']++;
        }
    }
    bool ans = true;
    int h1 = h,w1 = w;
    if(h1%2==1) {
        h1--;
    }
    if(w1%2==1){
        w1--;
    }
    int c4 = (h1)*(w1)/4,c2=0;
    int num4 = 0,num2=0,odd = 0;   
    for(int i=0;i<26;i++){
        num4 += c[i]/4;
        c[i]%=4;
    }
    for(int i=0;i<26;i++){
        num2 += c[i]/2;
        c[i]%=2;
    }
    for(int i=0;i<26;i++){
        odd += c[i];
    }
    if(num4>c4){
        num2+=(num4-c4)*2;
        num4=c4;
    }
    if(num4!=c4){
        ans = false;
    }
    if(h%2==1){
        c2 += w/2;
    }
    if(w%2==1){
        c2+=h/2;
    }
    if(num2!=c2)
        ans = false;
    if(h%2==1&&w%2==1){
        if(odd!=1)
            ans = false;
    }
    if(ans)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
//        VIVEK UPADHYAY
//        MANIT, BHOPAL(M.P)


//                         JAB-TAK TODEGA NHI,
//                         TAB -TAK CHODEGA NHI :D
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
using namespace std;
#define F first
#define S second
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define LINE cout<<endl
#define ok cout<<"ok\n" ;
typedef long long ll;
const int MAXN = 1e6 + 10 ;
const int MAX = 1e7 ;
double pi = 3.1415926535897932384626433832795;
const ll inf=1e18 ;
int main() {
    
    int N ,M;
    cin >> N >>M;
    
    cout<< N*M - N - M + 1<<endl;
    
    return 0 ;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

// http://drken1215.hatenablog.com/entry/2019/03/24/091900
int main() {
    int N;
    ll x;
    cin >> N >> x;
    vector<ll> a(N);
    REP(i, N) { cin >> a[i]; }
    ll s = accumulate(a.begin(), a.end(), 0LL);
    if(s < x) {
        cout << N - 1 << endl;
        return 0;
    }
    if(s == x) {
        cout << N << endl;
        return 0;
    }
    //というかgreedyにいける
    sort(a.begin(), a.end());
    int cnt = 0;
    REP(i, N) {
        x -= a[i];
        if(x >= 0) {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

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

int main() {
	ll q, h, s, d, n;
	cin >> q >> h >> s >> d >> n;
	ll m = min({4 * q, 2 * h, s});
	ll t = min(2 * m, d);
	ll ans;
	if (n % 2 == 0) {
		ans = (n/2)*t;
		cout << ans << endl;
	}else{
		ans = (n/2)*t + m;
		cout << ans << endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>          // printf(), scanf()
#define MAX_N 100

int
main(int argc, char** argv)
{
	int x[MAX_N], y[MAX_N];
	int n;
	int i;

	scanf("%d", &n);
	for (i = 0; i < n; ++i)
		scanf("%d %d", &x[i], &y[i]);

	double area = 0.0;
	for (i = 1; i <= n; ++i)
		area += x[i - 1] * y[i % n] - y[i - 1] * x[i % n];

	area /= 2;
	printf("%.1f\n", area);
	return 0;
}

Measured memory_bytes: 640
import math
n = int(input())
lst = list(map(int, input().split()))

res = 0
lst2 = [0]*n
for i in range(n):
  lst2[i] = lst[i] - i
lst2.sort()

p = lst2[n//2]
q = lst2[n//2-1]
ps = qs = 0
for i in range(n):
  ps += abs(lst[i] - (p+i))
  qs += abs(lst[i] - (q+i))
print(min(ps, qs))

Measured memory_bytes: 88532
//بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int a[n], b[n];
    for(int i = 0; i < n; b[i] = a[i], i++)
        cin >> a[i];
    sort(a, a+n, greater<int>());
    for(int i = 0; i < n; i++){
        if(b[i] == a[0]) cout << a[1] << endl;
        else cout << a[0] << endl;
    }
}


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

int ans() {
  int count = 0;
  for (int i = 0; i <= N / 4; i++) {
    for (int j = 0; j <= N / 7; j++) {
      int sum = i * 4 + j * 7;
      if (sum == N) {
        count++;
      }
    }
  }
  return count;
}


int main(void) {
  cin >> N;
  int res = ans();
  if(res > 0 ){
    cout << "Yes" <<endl;
  } else {
    cout << "No" <<endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
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 K;
    int[] p;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.K = sc.nextInt();
        this.p = new int[N];
        for (int i=0; i<N; i++) {
        	p[i] = sc.nextInt();
        }
    }
    
    //解答処理
    private int solve() {
        Arrays.sort(p);
    	int answer = 0;
        for (int i=0; i<K; i++) {
        	answer += p[i];
        }
        
        return answer;
    }
    
    //出力
    public void show(int answer) {
        System.out.println(answer);
    }

}


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

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

    vector<int> avoidt(w,0);

    auto f=[&](){
        int fw=-1;
        for(int i=0;i<w;i++){
            if(a[i]==0){
                fw=1e6;
            }
            if(a[i]<0){
                fw=min(fw,abs(a[i]));
            }
            if(a[i]>0){
                avoidt[i]=max(avoidt[i],min(fw,a[i]));
            }
            fw--;
        }
        return;
    };
    
    f();
    reverse(a.begin(),a.end());
    reverse(avoidt.begin(),avoidt.end());
    f();

    cout<<accumulate(avoidt.begin(),avoidt.end(),0)<<endl;
    
    return 0;
}


Measured memory_bytes: 3632