akhauriyash/Code-Regression huggingface dataset:
using System;
        using System.Linq;
        using System.Collections.Generic;
        using static System.Math;

        public class Program
        {
            public static void Main(string[] args)
            {
            string input = Console.ReadLine();
            List<string> inputList = new List<string> { };
            int answer = 0;

            foreach (char i in input)
            {
                inputList.Add(i.ToString());
            }

            for (int j = 0; j < inputList.Count() - 2; j++)
            {
                if (j == 0) answer = Math.Abs(int.Parse(inputList[j] + inputList[j + 1] + inputList[j + 2]) - 753);
                int stock = Math.Abs(int.Parse(inputList[j] + inputList[j + 1] + inputList[j + 2]) - 753);
                if (stock < answer) answer = stock;
            }

            Console.WriteLine(answer);
            Console.ReadKey();
            }
        }

Measured memory_bytes: 11220
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};

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

    int n;
    cin >> n;

    V v;

    M mp;

    for (int q = 3; q <= 9; q++)
    {
        for (int i = 0; i < pow(3, q); i++)
        {
            int n_ = 0;
            int p = 1;

            bool a[3] = {false};
            int b[3];

            b[0] = 3;
            b[1] = 5;
            b[2] = 7;

            int j = i;

            REP(k, q)
            {
                n_ += b[j % 3] * p;
                p *= 10;
                a[j % 3] = true;
                j /= 3;
            }

            if (a[0] && a[1] && a[2])
            {
                if (!mp[n_])
                    v.push_back(n_);

                mp[n_] = 1;
            }
        }
    }
    int res = 0;

    for (int i : v)
    {
        if (n >= i)
        {
            res++;
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <numeric>
#include <vector>
#include <math.h>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
using namespace std; 
int main(){
    int a; cin >> a;
    set<long long> S;
    for (int i=0;i<a;i++){
        long long z; cin >> z;
        S.insert(z);
    }
    if (S.size()==a) cout << "YES" << "\n";
    else cout << "NO" << "\n";
    
    
}








Measured memory_bytes: 9600
using System;

namespace OJcsharp
{
    class Program
    {
        static string seiseki(string[] str)
        {
            if (str[0] == "-1" || str[1] == "-1")
                return "F";
            int x = int.Parse(str[0]) + int.Parse(str[1]);
            if (x < 30)
                return "F";
            if (int.Parse(str[2]) >= 50)
                return "C";
            if (x < 50)
                return "D";
            if (x < 65)
                return "C";
            if (x < 80)
                return "B";
            return "A";
        }
        static void Main(string[] args)
        {
            string[] ans = new string[100000];
            int count = 0;
            do
            {
                string[] str = Console.ReadLine().Split(' ');
                if (str[0] == "-1" && str[1] == "-1" && str[2] == "-1")
                    break;
                ans[count] = seiseki(str);
                count++;
            } while (true);
            for (int n = 0; n < count; n++)
            {
                Console.WriteLine(ans[n]);
            }
        }
    }
}

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

int main() {
  int n, i;
  cin >> n >> i;
  n = n+1;

  for(int j = 0; j<n; j++){
      if(n-i-j==0){
          cout << j;
      }else{

      }
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int R, G, B, N;
  scanf("%d %d %d %d", &R , &G , &B , &N);

  int count = 0;
  for(int r = 0 ; r <= 3000 ; r++){
    for(int g = 0 ; g <= 3000 ; g++){

      int v = r*R + g*G;
      if(N >= v && (N - v) % B == 0)   count++;

    }
  }

  printf("%d", count);

return 0;
}

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

public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        String str = f.readLine();
        int n = str.length();
        StringBuilder ans = new StringBuilder();
        for(int i = 0; i < n; i++){
            if(str.charAt(i) == '?'){
                ans.append('D');
            }else{
                ans.append(str.charAt(i));
            }
        }
        out.println(ans.toString());



        out.close();
    }
}


Measured memory_bytes: 37456
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <utility>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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;}
using ll = long long;
constexpr long long INF = 1LL << 62;
constexpr int MOD = 1e9 + 7;

struct Edge {
    int src, dst, cost;
    Edge(int s, int d, int c = 1) : src(s), dst(d), cost(c) {}
    bool operator<(const Edge &e){ return cost < e.cost;}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

// O(|V|+|E|)log|V|)
void dijkstra(int s, Graph &g, vector<long long> &dist) {
    using Info = pair<long long, int>;
    // init
    dist.assign(g.size(), INF);
    dist[s] = 0;
    priority_queue<Info, vector<Info>, greater<Info> > pq;
    pq.emplace(0, s);
    //
    // main
    while(!pq.empty()){
        long long d = pq.top().first;
        int v = pq.top().second;
        pq.pop();
        if(dist[v] < d) continue;
        for(Edge e : g[v]){
            if(dist[e.dst] > dist[v] + e.cost){
                dist[e.dst] = dist[v] + e.cost;
                pq.emplace(dist[e.dst], e.dst);
            }
        }
    }
    //
}

int N,M,S,T;


int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> N >> M;
    Graph g(N*3);
    REP(i,M){
        int u,v;
        cin >> u >> v;
        --u; --v;
        REP(j, 3)
        g[u*3+j].emplace_back(u*3+j,v*3+(j+1)%3);
    }

    cin >> S >> T;
    --S; --T;
    vector<long long> dist;
    dijkstra(S*3, g, dist);
    if(dist[T*3] == INF) cout << -1 << '\n';
    else cout << dist[T*3]/3 << '\n';
    return 0;
}

Measured memory_bytes: 19072
import java.util.*;
public class Main {

	public void doIt(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			double term = sc.nextDouble();
			double sum = 0.0;
			for(int i=0; i < 5; i++){
				sum += term;
				term *= 2;
				sum += term;
				term = term / 3;
			}
			System.out.printf("%1.8f\n",sum);
		}
	}
	public static void main(String[] args) {
		Main obj = new Main();
		obj.doIt();

	}

}

Measured memory_bytes: 12000
#include <stdio.h>
#include <algorithm>
using namespace std;
const int N=1e5+10;
int main(){
    int n,temp,a[N];
    long long int ans,now,tot;
    while(true){
        scanf("%d",&n);
        if(n==0)return 0;
        scanf("%lld",&tot);
        now=n;
        n--;
        for(int i=0;i<n;i++){
            scanf("%d",&temp);
            tot+=temp;
        }
        for(int i=0;i<n;i++)scanf("%d",&a[i]);
        sort(a,a+n);
        ans=now*tot;
        for(int i=n-1;i>=0;i--){
            tot+=a[i];
            now--;
            ans=max(ans,now*tot);
        }
        printf("%lld\n",ans);
    }
}


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

int H, W;
int field[51][51];

//動的計画法
void dfs(int h, int w){
    field[h][w] = 0;

    //八方向を１つずつ探索
    for(int dh = -1; dh <= 1; dh++){
        for(int dw = -1; dw <= 1; dw++){
            int nh = h + dh;
            int nw = w + dw;

            //場外アウトまたは０ならば、それ以降（再帰的に探索する部分）は実行せずループの最初に戻る
            if(nh < 0 || nh > H || nw < 0 || nw > W || field[nh][nw] == 0) continue;

            //再帰的に探索（探索しているマスを基準にしてその八方向にあるマスを探索していく）
            dfs(nh, nw);
        }
    }
}

int main(void){
    while(true){
        cin >> W >> H;
        if(W + H == 0) break;

        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                cin >> field[i][j];
            }
        }

        //探索開始
        int c = 0; //島の個数
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if(field[i][j] == 0) continue; //島の一部でないならば、それ以降スルー
                dfs(i, j); //そのマスが陸であるならば、その八方向を動的計画法で探索していく
                c++;
            }
        }
        cout << c << endl;
    }
}



Measured memory_bytes: 3300
#include <bits/stdc++.h>
typedef long long intl;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define INF = 1e9;
using namespace std;
int main(){
    string s;
    cin >> s;
    string t;
    cin >> t;
    intl a;
    cin >> a;
    intl b;
    cin >> b;
    string u;
    cin >> u;
    if(s == u)a--;
    if(t == u)b--;
    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque
S=deque(input())
ans=""
Q=int(input())
tmp=0
r=[]
l=[]

for i in range(Q):
    que=input().split()
    if que[0]=='1':
        tmp=1-tmp
    if que[0]=='2':
        if que[1]=='1':
            if tmp==0:
                #S=que[2]+S
                #l.append(que[2])
                #ans=ans+que[2]
                S.appendleft(que[2])
            else:
                #S=S+que[2]
                #r.append(que[2])
                #ans=que[2]+ans
                S.append(que[2])
        else:
            if tmp==0:
                #S=S+que[2]
                #r.append(que[2])
                #ans=que[2]+ans
                S.append(que[2])
            else:
                #S=que[2]+S
                #l.append(que[2])
                #ans=ans+que[2]
                S.appendleft(que[2])
#print(que)
"""
for i in range(Q):
    if que[i][0]=='1':
        tmp=1-tmp
    if que[i][0]=='2':
        if que[i][1]=='1':
            if tmp==0:
                S=que[i][2]+S
            else:
                S=S+que[i][2]
        else:
            if tmp==0:
                S=S+que[i][2]
            else:
                S=que[i][2]+S
"""
#print(tmp)
"""
for i in range(len(r)):
    S=S+r[i]
    ans=r[i]+ans
for i in range(len(l)):
    S=l[i]+S
    ans=ans+l[i]
"""
if tmp==1:
    print("".join(reversed(S)))
    exit()

print("".join(S))

Measured memory_bytes: 73944
# -*- coding:utf-8 -*-

def solve():
    N = int(input())
    S = input()

    kuro_num = 0
    siro_num = 0
    for moji in S:
        if moji == "#":
            kuro_num += 1
        else:
            siro_num += 1

    """
    ######################
    .#####################
    ..####################
    (略)
    ..........############
    (略)
    ....................##
    .....................#
    ......................
    の全パターンのうち、最も回数が少ないものが答え
    """
    right_kuro_num = kuro_num
    right_siro_num = siro_num
    ans = siro_num
    for moji in S:
        if moji == "#":
            right_kuro_num -= 1
        else:
            right_siro_num -= 1
        num = right_siro_num + (kuro_num - right_kuro_num)
        ans = min(ans, num)

    print(ans)

"""
26
...##..##...##.....#..#..#
"""
if __name__ == "__main__":
    solve()

Measured memory_bytes: 3500
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <string.h>
#include <iomanip>
using namespace std;
#define int long long
#define ull unsigned long long
#define F first
#define S second
#define nl "\n"
#define ld long double
#define div 1000000007
#define pi 3.14159265358979323846
#define pb push_back
const int N=10001;
int a[N];
void solve()
{
    int n;cin>>n;
    for(int i=1;i<100;i++)
    {
        for(int j=1;j<100;j++)
        {
            for(int k=1;k<100;k++)
            {
                int t=i*i+j*j+k*k+i*j+j*k+k*i;
                if(t<=n){
                a[t]++;
                }
            }
        }
    }
    for(int i=1;i<=n;i++)
        cout<<a[i]<<nl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);

    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


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

///////////////////////////////////////////
//const long long int INF = 1000000000000000000LL;
const long long int INF = 1000000;
using ll = long long int;
using vi = vector<int>;
using Vi = vector<long long int>;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return 1; } return 0; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return 1; } return 0; }
template<class T>T sqar(T x){ return x*x; }
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(    v[0])>()) //降順でVをソート
///////////////////////////////////////////

int main(){
    ll n;cin>>n;
    string v[101];
    string ss;
    rep(i,n){
        cin>>v[i];
    }
    bool x=true;
    rep(i,n){
        rep(j,n){
            if(i!=j && v[i]==v[j]){
                x=false;
            }
        }
    }
    rep(i,n){
        if(i==0){

        }else{
            if(x&& v[i][0]!=v[i-1][v[i-1].size()-1]){
                x = false;
                break;
            }
        }
    }
    if(x){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ls (x<<1)
#define rs (x<<1|1)
const int N=200050;
using namespace std;
int gi(){
  char ch=getchar(); int x=0,q=0;
  while(ch<'0' || ch>'9') (ch=='-'?q=1:0),ch=getchar();
  while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
  return q?(-x):x;
}
int tr[N<<2],laz[N<<2],n,m;
struct date{
  int l,r;
  bool operator < (const date &c) const {
    return l<c.l;
  }
}p[N];
int Max(int a,int b){
  return a>b?a:b;
}
void update(int x){
  tr[x]=Max(tr[ls],tr[rs]);
  return;
}
void down(int x){
  tr[ls]+=laz[x],laz[ls]+=laz[x];
  tr[rs]+=laz[x],laz[rs]+=laz[x];
  laz[x]=0; return;
}
void build(int x,int l,int r){
  if (l==r){
    tr[x]=l-m; return;
  }
  int mid=(l+r)>>1;
  build(ls,l,mid),build(rs,mid+1,r);
  return update(x);
}
void Update(int x,int l,int r,int ql,int qr){
  if (ql<=l&&r<=qr) {
    ++tr[x],++laz[x]; return;
  }
  int mid=(l+r)>>1;
  if (laz[x]) down(x);
  if (ql<=mid) Update(ls,l,mid,ql,qr);
  if (qr>mid) Update(rs,mid+1,r,ql,qr);
  return update(x);
}
int main(){
  n=gi(),m=gi()+2;
  for (int i=1; i<=n; ++i)
    p[i]=(date){gi()+1,gi()+1};
  build(1,1,m);
  sort(p+1,p+n+1);
  int ans=0,id=1;
  for (int i=1; i<=m; ++i){
    for ( ; id<=n&&p[id].l==i; ++id)
      Update(1,1,m,1,p[id].r);
    Update(1,1,m,1,i);
    ans=Max(ans,tr[1]-i+1);
  }
  cout<<ans;
  return 0;
}


Measured memory_bytes: 7040
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  int n,m,x;
  cin >> n >> m >> x;
  vector<int> cost(n);
  vector<vector<int>> up(n,vector<int>(m));
  for(int i = 0;i < n;i++){
    cin >> cost[i];
    for(int j = 0;j < m;j++){
      cin >> up[i][j];
    }
  }
  int res = 0;
  res = INT_MAX;
  for(int i = 0; i < (1<<n); i++){//2のa乗回繰り返す(0 ~ 2^a- 1)
    vector<int> now(m);
    int nowcost = 0;
    for(int j = 0;j < m;j++)now[j] = 0;
    for(int j = 0;j < n;j++){
    if(i & (1<<j)){//小さい方からj桁目(0から)が1であったら
      nowcost += cost[j];
      for(int k = 0;k < m;k++){
        now[k] += up[j][k];
      }
    }
    }
    bool yes = true;
    for(int j = 0;j < m;j++){
      if(now[j] < x)yes = false;
    }
    if(yes)res = min(res,nowcost);
  }
  if(res == INT_MAX)res = -1;
  cout << res << endl;
}

Measured memory_bytes: 3632
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>

#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>

#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

// type
#include <cstdint>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N;
    cin >> N;
    map<P, int> m;
    for (int n = 1; n <= N; n++) {
        int r = n % 10;
        if (r == 0) continue;
        int l = n;
        while (l >= 10) l /= 10;
        m[P(l, r)]++;
    }

    int ret = 0;
    for (int n = 1; n <= N; n++) {
        if (n % 10 == 0) continue;
        int r = n % 10;
        int l = n;
        while (l >= 10) l /= 10;
        ret += m[P(r, l)];
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
   int n,m,u,v;
   cin>>n>>m;
   vector<vector<int>> g(n+1);
   for(int i=0;i<m;i++){
     cin>>u>>v;
     g[u].emplace_back(v);
     g[v].emplace_back(u);
   }
   vector<int> ans(n+1);
   queue<int> bfs;
   vector<bool> vis(n+1);
   bfs.push(1);
   vis[1]=1;
   while(!bfs.empty()){
      int u = bfs.front();
      bfs.pop();
      for(int v:g[u]){
        if(!vis[v]){
           vis[v]=1;
           ans[v]=u;
           bfs.push(v);
        }
      }
   }
   bool ispos=1;
   for(int i=2;i<=n;i++){
      if(!ans[i]){
         ispos=0;
         break;
      }
   }
   if(!ispos) cout<<"No"<<"\n";
   else{
      cout<<"Yes"<<"\n";
      for(int i=2;i<=n;i++)
          cout<<ans[i]<<"\n";
   }
   return 0;
}

Measured memory_bytes: 10096
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;

void solve()
{
    int x;
    cin >> x;
    cout << (1^x) << '\n';
}

int main()
{
    fastIO;
    int t=1;
    // cin >> t;
    while (t--) {
        solve();
    }   
}

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


typedef long long ll;

ll mod = 1e9+7;
int main(){
    ll n, k;
    cin >> n >> k;
    n+=1;
    ll prev_sum = 0LL;
    ll last_sum = 0LL;
    for(int i=1; i<k; i++){
        prev_sum+=i;
        last_sum+=(n-i+1);
    }
    ll ans = 0LL;
    for(int i=k; i<n+1; i++){
        prev_sum += i;
        last_sum += (n-i+1);
        //cout << last_sum << " " << prev_sum<< endl;
        ans += (last_sum - prev_sum + 1);
        
    }
    cout << ans % mod << endl;
}

Measured memory_bytes: 3592
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
//#define fi first
//#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;

  int low = INT32_MAX;
  int result = 0;
  F0R(i, N) {
    int p;
    cin >> p;
    chmin(low, p);
    if (low >= p) result++;
  }

  cout << result;
}
#endif


Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool isprime(int x){
  if(x == 2){
    return true;
  }
  if(x < 2 || x % 2 == 0){
    return false;
  }

  int i=3;

  while(i*i <= x){
    if(x % i == 0){
      return false;
    }

    i = i+2;
  }

  return true;;
}

int main(){
  int n;
  cin >> n;
  
  int cnt=0;
  
  for(int i=0; i<n; ++i){
    int work;
    cin >> work;

    if(isprime(work))
      ++cnt;
  }

  cout << cnt << "\n";


  return 0;
}



Measured memory_bytes: 3100
main :: IO ()
main = do
  n <- readLn :: IO Int
  as <- map read . words <$> getLine :: IO [Int]
  print $ solve as

solve :: [Int] -> Int
solve as = minimum $ map (abs . (s -) . (2 *)) ss
  where
    s = sum as
    ss = scanl1 (+) $ init as


Measured memory_bytes: 63868
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;

int main() {
    int N, M;
	cin >> N >> M;

    vector<int> cnt(M, 0);

    for(int i=0;i<N;i++){
        int k;
        cin >> k;
        for(int j=0;j<k;j++){
            int z;
            cin >> z;
            cnt[z-1]++;
        }
    }

    int res = 0;
    for(int i=0;i<M;i++){
        if(cnt[i] == N){
            res++;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    #include <math.h>
 
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    # define M_PI  3.14159265358979323846
 
 
    const int M=1e9+7;
    long long mod(long long x){
        return ((x%M + M)%M);
    }
    long long add(long long a, long long b){
        return mod(mod(a)+mod(b));
    }
    long long mul(long long a, long long b){
        return mod(mod(a)*mod(b));
    }
    long long minu(long long a, long long b){
        return mod(mod(a)-mod(b));
    }
    ll modPow(ll a, ll b){
        if(b==0)
            return 1LL;
        if(b==1)
            return a%M;
        ll res=1;
        while(b){
            if(b%2==1)
                res=mul(res,a);
            a=mul(a,a);
            b=b/2;
        }
        return res;
    }
    
    vector<int>dirX={-1,0,1};
    vector<int>dirY={-1,0,1};
 
 
    void solve(){
        ll n;
        cin>>n;
        if(n==1){
            cout<<0;
            return;
        }
        if(n==2){
            cout<<2;
            return;
        }
        ll ans=minu(add(modPow(10LL,n),modPow(8LL,n)),mul(2LL,modPow(9LL,n)));
        cout<<ans;
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
//        freopen("timber_input.txt", "r", stdin);
//        freopen("timber_output.txt", "w", stdout);
        int t=1;
        // cin>>t;
        for(int i=1;i<=t;i++){
        //    cout<<"Case #"<<i<<": ";
            solve();
        }
        return 0;
    }

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

int main() {
	int n, q;
	string s;
  cin >> n >> q >> s;
	vector<int> dp(n);

	rep(i, n-1) {
		dp[i+1] = dp[i];
		if (s[i]=='A' && s[i+1]=='C') ++dp[i+1];
	}
	rep(i, q) {
		int l, r; cin >> l >> r;
		l--, r--;
		cout << dp[r] - dp[l] << endl;
	}

	return 0;
}


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

using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
 
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); }
 
template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int updiv(int a,int b){ return (a + b - 1) / b; }
 
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
constexpr int dy[] = {0,-1,0,1,1,-1,-1,1};


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

	int a, b;
	cin >> a >> b;

	cout << a * b << '\n';

	return 0;
}

Measured memory_bytes: 3620
s=int(input())
b=0
cnt=0
a=[0]*1000001
while b==0:
    cnt+=1
    if a[s]==1:
        b=1
    else:
        a[s]=1
        if s%2==0:
            s=s//2
        else:
            s=3*s+1
print(cnt)

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

int main() {
  string S;
  string ans;

  cin >> S;

  if (S == "Sunny") {
    ans = "Cloudy";
  }
  else if (S == "Cloudy") {
    ans = "Rainy";
  }
  else {
    ans = "Sunny";
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();

    let s = get().as_bytes();
    let n = s.len();
    let mut vs = vec![0; n+1];
    use std::cmp::max;
    for i in 0 .. n {
        if s[i] == b'<' {
            vs[i+1] = max(vs[i+1], vs[i] + 1);
        }
        let i = (n-1) - i;
        if s[i] == b'>' {
            vs[i] = max(vs[i], vs[i+1] + 1);
        }
    }
    let ans = vs.iter().sum::<i64>();
    println!("{:?}", ans);
}

Measured memory_bytes: 8444
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

#ifdef WIN32
	#define LL "%I64d"
#else
	#define LL "%lld"
#endif

#ifdef CT
	#define debug(...) printf(__VA_ARGS__)
	#define setfile() 
#else
	#define debug(...)
	#define filename ""
	#define setfile() freopen(filename".in", "r", stdin); freopen(filename".out", "w", stdout)
#endif

#define R register
#define getc() (_S == _T && (_T = (_S = _B) + fread(_B, 1, 1 << 15, stdin), _S == _T) ? EOF : *_S++)
#define dmax(_a, _b) ((_a) > (_b) ? (_a) : (_b))
#define dmin(_a, _b) ((_a) < (_b) ? (_a) : (_b))
#define cmax(_a, _b) (_a < (_b) ? _a = (_b) : 0)
#define cmin(_a, _b) (_a > (_b) ? _a = (_b) : 0)
#define cabs(_x) ((_x) < 0 ? (- (_x)) : (_x))
char _B[1 << 15], *_S = _B, *_T = _B;
inline int F()
{
	R char ch; R int cnt = 0; R bool minus = 0;
	while (ch = getc(), (ch < '0' || ch > '9') && ch != '-') ;
	ch == '-' ? minus = 1 : cnt = ch - '0';
	while (ch = getc(), ch >= '0' && ch <= '9') cnt = cnt * 10 + ch - '0';
	return minus ? -cnt : cnt;
}

int main()
{
//	setfile();
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	if (a == b && b == c) printf("1\n");
	else if (a == b || b == c || a == c) printf("2\n");
	else printf("3\n");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
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; }
int main()
{
    int N;
    cin >> N;
    vector<pair<string, int>>vec(N);
    for (int i=0; i<N; i++) {
        string s;
        int n;
        cin >> s >> n;
        vec[i] = make_pair(s, -1*n);
    }

    vector<pair<string, int>>orig(N);
    copy(vec.begin(), vec.end(), orig.begin());
    sort(vec.begin(), vec.end());

    for (int i=0; i<N; i++) {
        string s = vec[i].first;
        int num = vec[i].second;
        for (int j=0; j<N; j++) {
            if (s == orig[j].first && num == orig[j].second) {
                cout << j + 1 << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3592
N, M = (int(i) for i in input().split())
CL = 1
CR = N
for i in range(M):
	L, R = (int(i) for i in input().split())
	if CL < L:
          CL = L
	if CR > R:
          CR = R

C = CR-CL
if C < 0:
	print(0)
else:
	print(C + 1)


Measured memory_bytes: 3060
#include<stdio.h>
#include<limits.h>
#include<stdlib.h>
int MIN(int a, int b){return a>b?b:a;}

int main(void){
    int n,l;
    scanf("%d%d", &n, &l);

    int s[n+1];
    s[0] = 0;
    for(int i=1; i<n+1; i++){
        s[i] = s[i-1] + (l+i-1);
        //printf("%d ", s[i]);
    }

    int ans = INT_MAX;
    int index;
    for(int i=1; i<=n; i++){
        //int tmp = s[n] - (s[n]-(l+i-1));
        int tmp = l+i-1;
        if(tmp < 0){
            tmp = tmp*(-1);
        }
        if(ans > abs(s[n]-(s[n]-tmp))){
            ans = abs(s[n]-(s[n]-tmp));
            index = i;
        }
    }

    printf("%d\n", s[n]-(l+index-1));
}

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

int main(){
  int n,m,x;
  cin >> n >> m >> x;
  vector<int> A(m+10);
  vector<int> B(n+10);
  int a = 0;
  int b = 0;
  rep(i,m) cin >> A[i];
  rep(i,m){
    B[A[i]] += 1;
  }
  rep(i,n){
    if(i < x) a += B[i];
    if(i > x) b += B[i];
  }
  cout << min(a,b) << endl;
}

Measured memory_bytes: 256
//abc105_d.cpp
//Sat Aug 18 15:19:33 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int main(){
	int n,m;
	cin >> n >> m;
	int a[n];
	ll imos[n];
	unordered_map<int,int> amari;
	ll ans = 0;
	ll comb[n];
	for (int i=0;i<n;i++){
		cin >> a[i];
		if (i>0){
			imos[i] = imos[i-1]+a[i];
		}else{
			imos[i] = a[i];
		}
		amari[imos[i]%m]++;
		if (imos[i]%m==0){
			ans++;
		}
	}

	for (auto i=amari.begin();i!=amari.end();i++){
		if (i->second>1){
			ans += combination(i->second,2);
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 4388
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define llu unsigned long long
#define ld double
#define llu unsigned long long
#define rep(i,x,y)  for(ll i=x;i<y;++i)
#define For(i,x,y)  for(ll i=x;i<=y;++i)
#define FOr(i,x,y)  for(ll i=x;i>=y;--i)
#define pi acos(-1)
#define mk make_pair<ll,ll>
#define pa pair<ll,ll>
#define lf else if
#define max(x,y)    ((x)<(y)?(y):(x))
#define min(x,y)    ((x)<(y)?(x):(y))
#define sqr(x)      ((x)*(x))
#define abs(x)      ((x)>0?(x):-(x))
#define Mul(x,y)    ((x)=1LL*(x)*(y)%mod)
#define Add(x,y)    ((x)=((x)+(y))%mod)
#define Max(x,y)    ((x)=((x)<(y)?(y):(x)))
#define Min(x,y)    ((x)=((x)>(y)?(y):(x)))
#define E(x)        return writeln(x),0
#define p(x)        printf("~%lld~\n",(long long)x)
#define pp(x,y)     printf("~~%lld %lld~~\n",(long long)x,(long long)y)
#define ppp(x,y,z)  printf("~~~%lld %lld %lld~~~\n",(long long)x,(long long)y,(long long)z)
#define pppp(a,b,c,d)	printf("~~~%lld %lld %lld %lld\n",(long long)a,(long long)b,(long long)c,(long long)d)
#define f_in(x)     freopen(x".in","r",stdin)
#define f_out(x)    freopen(x".out","w",stdout)
#define open(x)     f_in(x),f_out(x)
#define GuYue		puts("\nGuYueNa________________________________________________________________________________")
typedef complex<double> E;
namespace SHENZHEBEI{
#ifdef LOCAL
    struct _{_(){freopen("cf.in","r",stdin);}}_;
#endif
#define NEG 1
#if NEG
    inline ll read(){    ll x=0,fa=1; char ch=getchar();   for (;!isdigit(ch);ch=getchar()) if (ch=='-') fa=-1;  for (;isdigit(ch);ch=getchar())  x=x*10-48+ch;   return x*fa; }
    inline void write(ll x){    if (x<0) putchar('-'),x=-x;  if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#else
    inline ll read(){    ll x=0; char ch=getchar();   for (;!isdigit(ch);ch=getchar());    for (;isdigit(ch);ch=getchar())  x=x*10-48+ch;   return x;   }
    inline void write(ll x){    if (x>=10)   write(x/10);    putchar(x%10+'0');  }
#endif
	void writeln(ll x){write(x);puts("");}
	void Print(long long *a,int s,int t){For(i,s,t)printf("%lld ",a[i]);}
	void Print(int *a,int s,int t){For(i,s,t)printf("%d ",a[i]);}
	void Print(char *a,int s,int t){For(i,s,t)putchar(a[i]);}
}using namespace SHENZHEBEI;
const ll N=300100;
ll x,y;
ll findth(ll x,ll y){return y>=x?y+1:y;}
bool check(ll sum){
	ll cogito=sum/2;
	For(i,cogito-100,cogito+100)if ((i>0&&i<=sum))
	if ((findth(x,i)*findth(y,sum-i+1)>=x*y))
	return 0;
	return 1;
}
int main(){
	ll Q=read();
	for(;Q--;){
		x=read(),y=read();
		ll l=0,r=2e9,ans=0;
		for(;l<=r;){
			ll mid=(l+r)>>1;
			if (check(mid))ans=mid,l=mid+1;
			else	r=mid-1;
		}writeln(ans);
	}
}
/*
x-y

*/

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
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)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

int main(){
	ll H,W;
	cin>>H>>W;
	ll ans = INF;
	if(H*W % 3 == 0){
		ans = 0;
	}
	if(H*W % 2 == 0){
		ll a = 100000000, b = 100000000;
		if(H%2 == 0)a = H/2;
		if(W%2 == 0)b = W/2;
		ans = min({a,b,ans});
	}
	if((H-2) %3 == 0 && H >2){
		ans = min(ans, W);
	}
	if((W-2) %3 == 0 && W > 2){
		ans = min(ans, H);
	}
	ll lw = W/2+1;
	ll lh = H/2+1;
	ll sw = W/2;
	ll sh = H/2;
	ll B = lw*sh;
	ll C = sw*lh;
	ans = min(ans, sw*sh-abs(B-C));
	cout<<ans<<endl;
	return 0;
}

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

int main()
{
	int A[4],B[4];
	int a=0,b=0;
	scanf("%d %d %d %d",&A[0],&A[1],&A[2],&A[3]);
	scanf("%d %d %d %d",&B[0],&B[1],&B[2],&B[3]);
	a += A[0]+A[1]+A[2]+A[3];
	b += B[0]+B[1]+B[2]+B[3];
	if(a>b)
	{
		printf("%d\n",a);
	}
	else
	{
		printf("%d\n",b);
	}
	return 0;
}

Measured memory_bytes: 0
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

// ModInt
// region
class ModInt(x: Long) {

    companion object {
        const val MOD = 1000000007L
        //const val MOD = 998244353L
    }

    val x = (x % MOD + MOD) % MOD

    operator fun plus(other: ModInt): ModInt {
        return ModInt(x + other.x)
    }

    operator fun minus(other: ModInt): ModInt {
        return ModInt(x - other.x)
    }

    operator fun times(other: ModInt): ModInt {
        return ModInt(x * other.x)
    }

    operator fun div(other: ModInt): ModInt {
        return this * other.inv()
    }

    fun pow(exp: Long): ModInt {
        if (exp == 0L) return ModInt(1L)
        var a = pow(exp shr 1)
        a *= a
        if (exp and 1L == 0L) return a
        return this * a
    }

    fun inv(): ModInt {
        return this.pow(MOD - 2)
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as ModInt

        if (x != other.x) return false

        return true
    }

    override fun hashCode(): Int {
        return x.hashCode()
    }

    override fun toString(): String {
        return "$x"
    }

}

val fac = mutableListOf<ModInt>()
val invfac = mutableListOf<ModInt>()

fun fact(n: Long, b: Boolean): ModInt {
    if (fac.count() == 0) {
        fac.add(ModInt(1))
        invfac.add(ModInt(1))
    }
    while (fac.count() <= n) {
        fac.add(fac.last() * ModInt(fac.count().toLong()))
        invfac.add(fac.last().inv())
    }
    return if (b) {
        fac[n.toInt()]
    } else {
        invfac[n.toInt()]
    }
}

fun comb(n: Long, k: Long): ModInt {
    return fact(n, true) * fact(k, false) * fact(n - k, false)
}

fun comb2(n: Long, k: Long): ModInt {
    var ans = ModInt(1)
    for (i in 0 until k) {
        ans = ans * ModInt(n - i) / ModInt(k - i)
    }
    return ans
}

fun p(n: Long, k: Long): ModInt {
    return fact(n, true) * fact(n - k, false)
}
// endregion

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextLong()
    val m = sc.nextLong()
    var ans = p(m, n) * p(m, n)
    for (i in 1..n) {
        val v = p(m, n) * p(m - i, n - i) * comb(n, i)
        if (i % 2 == 0L) {
            ans += v
        } else {
            ans -= v
        }
    }
    println(ans)
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 91404
#include <stdio.h>
#include <string.h>
    
int main(void)
{
int i;
char s[100],sa[200],p[100];
scanf("%s\n%s\n",s,p);
char pa[strlen(p)];
strcpy(pa,p);
strcpy(sa,s);
for (i=0;i < strlen(s);i++){
sa[strlen(s)+i] = s[i];
}
if (strstr(sa,pa) != NULL)
{
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
}


Measured memory_bytes: 2780
import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;


void main() {
    int n;

    scan(n);
    auto a = readln.split.to!(int[]).sort();
    auto b = readln.split.to!(int[]).sort();
    auto c = readln.split.to!(int[]).sort();

    long ans;

    foreach (i ; 0 .. n) {
        int k = a.lowerBound(b[i]).length.to!int;
        int l = c.upperBound(b[i]).length.to!int;

        ans += 1L * k * l;
    }

    writeln(ans);
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 11260
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;
#define N 105
int n,x[N],y[N],h[N],t,a,b,c,H;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d%d%d",&x[i],&y[i],&h[i]),t=h[i]>0?i:t;
    for(int i=0;i<=100;i++)
        for(int j=0;j<=100;j++)
        {
            bool f=true;
            a=i; b=j; c=h[t]+abs(i-x[t])+abs(j-y[t]);
            for(int k=1;k<=n;k++)
            {
                H=max(0,c-abs(i-x[k])-abs(j-y[k]));
                if(H!=h[k]) {f=false;break;}
            }
            if(f==true)
            {
                printf("%d %d %d\n",a,b,c);
                return 0;
            }
        }
    puts("error");
    return 0;
}

Measured memory_bytes: 128
// AOJ 1190: Anchored Balloon
// 2017.12.8 bal4u@uu

#include <stdio.h>
#include <math.h>

#define N 100
int n;
int x[10], y[10], l[10];

double sach(double xx, double yy)
{
	int i;
    double t, ans = 1e10;

    for (i = 0; i < n; i++) {
        t = l[i]*l[i] - (xx-x[i])*(xx-x[i]) - (yy-y[i])*(yy-y[i]);
        if (t < ans) ans = t;
    }
    return ans;
}

double ysach(double xx)
{
	int i;
    double l = -100.0, r = 100.0, m1, m2;

    i = N; while(i--) {
        m1 = (2*l + r) / 3;
        m2 = (l + 2*r) / 3;
        if (sach(xx, m1) > sach(xx, m2)) r = m2; else l = m1;
    }
    return sach(xx, l);
}

double xysach()
{
	int i;
    double l = -100.0, r = 100.0, m1, m2;

    i = N; while (i--) {
        m1 = (2*l + r) / 3;
        m2 = (l + 2*r) / 3;
        if (ysach(m1) > ysach(m2)) r = m2; else l = m1;
    }
    return sqrt(ysach(l));
}

int main()
{
	int i;

    while (scanf("%d", &n) && n > 0) {
		for (i = 0; i < n; i++) scanf("%d%d%d", x+i, y+i, l+i);
        printf("%.07f\n", xysach());
    }
}

Measured memory_bytes: 1856
#include <stdio.h>

int main(void) {
int S,s,m,h;

scanf( "%d" , &S );
 h = S / 3600;
 s = S - h*3600;
 m = s / 60;
 s = s-m*60;
 
printf ("%d:%d:%d\n",h,m,s);
return 0;
}

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

int main(){

  int n,m,jo=1,prob=0,ev=0,fin=0,sumtime=0,ntime=100,mtime=1900;

  cin>>n>>m;

  for(int i=1; i<=m; i++) jo *= 2;

  prob = 1 / jo;  //全てのケースで正解する確率

  mtime *= m;

  ntime *= (n-m);

  sumtime = mtime + ntime;

  fin = 1 - prob; //終わる確率
  
  //ev = sumtime + (fin) * ev;

  ev = sumtime * jo;
  
  cout<<ev<<endl;

  return 0;

  
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    string S ,T ,U ;
    cin >> S >> T ;

    int A,B ;
    cin >> A>> B;
    cin>> U;
    if (U == S) {
        A = A-1 ;
        cout << A<<' '<<B ;
    }
    else {
        B =B-1 ;
        cout <<A <<' '<<B;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<utility>
#include<algorithm>
#include<vector>
#include<map>
#include<math.h>
using namespace std;

int main()
{
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long m, n, o, p;
    m = a * c;
    n = a * d;
    o = b * c;
    p = b * d;
    long long ans = max(max(m,n), max(o, p));
    cout << ans << endl;
}

Measured memory_bytes: 3504
program magic_square_2
  implicit none
  integer :: a, b, c, m(3,3)
  read(*,*) a
  read(*,*) b
  read(*,*) c
  m = 0
  m(1,1) = a
  m(1,2) = b
  m(1,3) = 3*c-a-b
  m(2,1) = 4*c-2*a-b
  m(2,2) = c
  m(2,3) = 2*a+b-2*c
  m(3,1) = a+b-c
  m(3,2) = 2*c-b
  m(3,3) = 2*c-a
  write(*,'(i0,x,i0,x,i0)') m(1,:)
  write(*,'(i0,x,i0,x,i0)') m(2,:)
  write(*,'(i0,x,i0,x,i0)') m(3,:)
  stop
end program magic_square_2

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int64_t T1,T2,A1,A2,B1,B2;
  cin>>T1>>T2>>A1>>A2>>B1>>B2;
  int64_t A=A1-B1;
  int64_t B=A2-B2;
  if((0<A&&0<B)||(A<0&&B<0))
    cout<<0<<endl;
  else if(A*T1+B*T2==0)
    cout<<"infinity"<<endl;
  else{
   if((0<A&&0<A*T1+B*T2)||(A<0&&A*T1+B*T2<0))
     cout<<0<<endl;
    else{
    int64_t a=abs(A*T1);
      int64_t b=abs(A*T1+B*T2);
      if(a%b==0)
        cout<<2*(a/b)<<endl;
      else
        cout<<2*(a/b)+1<<endl;
    
    
    }
  
  
  
  }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int j = 0;
		for(int i = 0;i <= a;i++) { 
			for(int s = 0;s <= b;s++) { 
				for(int q = 0;q <= c;q++) { 
					if(500 * i + 100 * s + 50 * q == x) {
						j++;
					}
				}
			}
		}
		System.out.println(j);	
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
const int N = 25;
int n;
int a[N], b[N], c[N];
int main() {
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i];
    for(int i = 1; i <= n; i++) cin >> b[i];
    for(int i = 1; i < n; i++) cin >> c[i];
    int ans = 0;
    a[0] = -2;
    for(int i = 1; i <= n; i++) {
        ans += b[a[i]];
        if(a[i] == a[i - 1] + 1) ans += c[a[i - 1]];
    }
    cout << ans;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		String a = scan.next();
		String b = scan.next();
		char a2 = a.charAt(0);
		char b2 = b.charAt(0);

		if (a2 == 'H') {
			if (b2 == 'H') {
				System.out.println("H");
			} else if (b2 == 'D') {
				System.out.println("D");
			}

		} else if (a2 == 'D') {
			if (b2 == 'H') {
				System.out.println("D");
			} else if (b2 == 'D') {
				System.out.println("H");
			}
		}

	}
}


Measured memory_bytes: 21972
/*input
5
2 6 1 4 5
*/
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll = long long;
using ld = long double;
using pii = pair<int,int>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll sub(ll a,ll b){
    ll x=a-b;
    while(x<0) x+=MOD;
    while(x>MOD) x-=MOD;
    return x;
}
ll mult(ll a,ll b){
    return a*b%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=(res*a)%MOD;
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
const int maxn=1e5+5;
int main(){
	int n;
	cin>>n;
	vector<int> v(n);
	REP(i,n) cin>>v[i];
	SORT_UNIQUE(v);
	if(sz(v)==n) cout<<"YES";
	else cout<<"NO";
}

Measured memory_bytes: 1024
#include <stdio.h>

int main() {
	int H, W;
	while (1) {
		scanf("%d %d", &H, &W);
		if (H == 0 && W == 0) {
			break;
		}
		for (int i = 0; i < H; i++) {
			for (int k = 0; k < W; k++) {
				if (i % 2 == 0) {
					if (k % 2 == 0) {
						printf("#");
					}
					else {
						printf(".");
					}
				}
				else {
					if (k % 2 == 0) {
						printf(".");
					}
					else {
						printf("#");
					}
				}
				
					
			}
			printf("\n");
		}
		printf("\n");
	}
}


Measured memory_bytes: 2548