akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int n;
    cin >> n;
    vector<pair<ll, ll>> p(n);
    rep(i, n) cin >> p[i].fi >> p[i].se;
    map<pair<ll, ll>, int> mp;
    rep(i, n-1) {
        srep(j, n, i+1) {
            pair<ll, ll> d1(p[j].fi - p[i].fi, p[j].se - p[i].se);
            pair<ll, ll> d2(p[i].fi - p[j].fi, p[i].se - p[j].se);
            mp[d1]++;
            mp[d2]++;
        }
    }
    int mx = 0;
    for (auto x : mp) {
        mx = max(mx, x.se);
    }
    int ans = n - mx;

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <deque>
#include <numeric>
#include <utility>
using namespace std;
#define LL long long
#define INF 1LL<<60

struct edge{LL from, to, cost;};

void solve(long long N, long long M, std::vector<long long> a, std::vector<long long> b, std::vector<long long> c){
    vector<edge> edges(M);
    for(LL i=0; i<M; i++)edges[i]=(edge){a[i]-1, b[i]-1, -c[i]};
    vector<LL> shortest(N, INF);
    shortest[0]=0;
    for(LL i=0; i<N; i++){
        for(auto e:edges){
            auto tmp = shortest[e.from]+e.cost;
            if(shortest[e.from] < INF && tmp < shortest[e.to]){
                if(i == N-1 && e.to == N-1){
                    cout << "inf" << endl;
                    return;
                }
                shortest[e.to] = tmp;
            }
        }
    }
    cout << -shortest[N-1] << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> a(M);
    std::vector<long long> b(M);
    std::vector<long long> c(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
        scanf("%lld",&c[i]);
    }
    solve(N, M, std::move(a), std::move(b), std::move(c));
    return 0;
}


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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n); i >= 0; i--)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define RREP(i, a, n) for(int i = (int)(n); i >= a; i--)
#define all(x) (x).begin(),(x).end()

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

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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

    vector<pair<ll, ll> > A(N);
    rep(i,N) cin >> A[i].first >> A[i].second;
    sort(all(A));

    //rep(i,N) cout << A[i].first << " " << A[i].second << endl;
    ll ans = 0;
    
    int key = 0;
    while( M > 0 )
    {
        if( A[key].second <= M )
        {
            M -= A[key].second;
            ans += A[key].first * A[key].second;
        }
        else
        {
            ans += M * A[key].first;
            M = 0;
        }
        key++;
        //cout << ans << endl;
    }
    cout << ans << endl;

    

}


Measured memory_bytes: 1792
#include<stdio.h>

int a[4];

int sum(int *p,int i,int n){
  if(i==n){
    return 0;
  }
  else{
    return p[i]+sum(p,i+1,n);
  }
}

int lpi(int *p,int i,int n){
  if(i==n){
    return 1;
  }
  else{
    return p[i]*lpi(p,i+1,n);
  }
}

int sq(int n){
  return n*n;
}

int largest(int *p){
  if(p[0]>p[1]){
    if(p[0]>p[2]){
      return 0;
    }
    else{
      return 2;
    }
  }
  else{
    if(p[1]>p[2]){
      return 1;
    }
    else{
      return 2;
    }
  }
}

void doit(){
  int e[3];
  if(scanf("%d %d %d",&e[0],&e[1],&e[2])!=EOF){
    int s=sum(e,0,3);
    int lst=largest(e);
    if(s>2*e[lst]){
      int apb=s-e[lst];
      int atb=lpi(e,0,3)/e[lst];
      a[0]++;
      if((sq(apb)-2*atb)==sq(e[lst])){
	a[1]++;
      }
      else if((sq(apb)-2*atb)>sq(e[lst])){
	a[2]++;
      }
      else{
	a[3]++;
      }
      doit();
    }
    else{
      int i;
      for(i=0;i<4;i++){
	char ns;
	printf("%d",a[i]);
	if(i==3){
	  ns='\n';
	}
	else{
	  ns=' ';
	}
	printf("%c",ns);
      }
    }
  }
}

int main(){
  int i;
  for(i=0;i<4;i++){
    a[i]=0;
  }
  doit();
  return 0;
}

Measured memory_bytes: 600
// 2020-09-07 21:44:47
// clang-format off
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

// clang-format on
void answer() {
  int wn, bn;
  cin >> wn >> bn;
  if (wn == 1 && bn == 1) {
    cout << "1 2\n.#\n";
    return;
  }
  char w = '.', b = '#';
  if (wn < bn) {
    swap(wn, bn);
    swap(w, b);
  }
  vector<string> ans;
  while (wn > 1) {
    int y = -1;
    {
      string s = "";
      rep(x, 50) {
        if (wn > 1) {
          wn--;
          y = x;
          (s += w) += b;
        } else {
          (s += w) += w;
        }
      }
      ans.emplace_back(s);
    }
    {
      string s = "";
      rep(x, 50) {
        if (x <= y) {
          (s += b) += b;
        } else {
          (s += w) += w;
        }
      }
      ans.emplace_back(s);
    }
  }
  ans.emplace_back(string(100, w));
  while (bn > 1) {
    {
      string s = "";
      rep(x, 50) {
        if (bn > 1) {
          bn--;
          (s += b) += w;
        } else {
          (s += w) += w;
        }
      }
      ans.emplace_back(s);
    }
    ans.emplace_back(string(100, w));
  }
  cout << ans.size() << " 100" << '\n';
  for (auto& s : ans) cout << s << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3636
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int ans = 0;
		if(s.equals("RRR")) {
			ans = 3;
		} else if(s.equals("RRS")||s.equals("SRR")) {
			ans = 2;
		} else if(s.equals("SSS")) {
			ans = 0;
		} else {
			ans = 1;
		}
		System.out.println(ans);
		
		sc.close();
	}
}


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

void solve() {
  int n, m;
  cin >> n >> m;
  priority_queue<int> q;
  rep(i,n) {
    int a;
    cin >> a;
    q.push(a);
  }
  rep(i,m) {
    int temp = q.top();
    q.pop();
    temp /= 2;
    q.push(temp);
  }
  ll ans = 0;
  while(!q.empty()) {
    ans += q.top();
    q.pop();
  }
  cout << ans << endl;
}

int main() {
  solve();
  return 0;
}

Measured memory_bytes: 892
# C - Tsundoku
from bisect import bisect
from itertools import accumulate


def main():
    N, M, K, *AB = map(int, open(0).read().split())
    cum_A, cum_B = tuple(accumulate([0] + AB[:N])), tuple(accumulate(AB[N:]))
    res = 0
    for i, a_time in enumerate(cum_A):
        if a_time > K:
            break
        b_time = K - a_time
        res = max(res, i + bisect(cum_B, b_time))
    print(res)


if __name__ == "__main__":
    main()


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

ruiseki = [0] * (n + 1)
for i in range(n):
    ruiseki[i+1] = ruiseki[i] + a[i]

li = []
for i in range(n):
    for j in range(i, n):
        tmp = format(ruiseki[j + 1] - ruiseki[i], '050b')
        li.append(tmp)

for i in range(50):
    cnt = 0
    new_li = []
    for j in range(len(li)):
        if li[j][i] == "1":
            new_li.append(li[j])
            cnt += 1
    if cnt >= k:
        li = new_li[0:]

ans = 2**50 -1
for i in range(k):
    ans = ans & int(li[i], 2)
print(ans)

Measured memory_bytes: 158892
N,K=map(int,input().split())

R,S,P=map(int,input().split())
T =input()

com = [0]*N

for i in range(N):
    if i>=K and T[i]==T[i-K] and com[i-K]!=0:
        continue
    
    elif T[i] =="r":
        com[i] =P
    elif T[i] =="s":
        com[i] =R
    else:
        com[i] =S

print(sum(com))
        
        


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

int main()
{
  int n, m, t, ac = 0, wa = 0;
  string ans;
  cin >> n >> m;
  vector<int> p(n+1, -1);
  for(int i = 0; i < m; i++){
    cin >> t >> ans;
    if(ans == "WA" && p.at(t) <= 0){p.at(t) -= 1;}
    if(ans == "AC" && p.at(t) <= 0){p.at(t) *= -1;}
  }
  for(int i = 1; i <= n; i++){
    if(p.at(i) > 0){
      ac += 1;
      wa += p.at(i) - 1;
    }
  }
  cout << ac << " " << wa << endl;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int m[][] = {
                { 1, 2, 1, 2, 1, 4, 1, 4 },
                { 1, 2, 1, 4, 1, 4, 1, 2 },
                { 1, 4, 1, 2, 1, 2, 1, 4 },
                { 1, 4, 1, 4, 1, 2, 1, 2 },
                { 2, 1, 2, 1, 4, 1, 4, 1 },
                { 2, 1, 4, 1, 4, 1, 2, 1 },
                { 4, 1, 2, 1, 2, 1, 4, 1 },
                { 4, 1, 4, 1, 2, 1, 2, 1 },
        };
        while (in.hasNext()) {
            int a[] = new int[8];
            for (int i = 0; i < 8; i++)
                a[i] = in.nextInt();

            int id = -1;
            int min = Integer.MAX_VALUE;
            for (int i = 0; i < 8; i++) {
                int sam = 0;
                for (int j = 0; j < 8; j++) {
                    int cnt = m[i][j] - a[j];
                    if (cnt > 0)
                        sam += cnt;
                }
                if (sam < min) {
                    min = sam;
                    id = i;
                }
            }
            for (int i = 0; i < 8; i++) {
                System.out.print(m[id][i] + (i != 7 ? " " : "\n"));
            }
        }
    }
}


Measured memory_bytes: 30004
function Main(input) {
  input = input.split("\n");
  var N = input[0];
  N -=1;
  N +=1;
  var S = input[1];
  for(var i = 0;i<S.length;i++){
    process.stdout.write(String.fromCodePoint(65+((S.charCodeAt(i)-65)+N)%26));
 }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 10136
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,k,ans;
	cin>>a>>b>>c>>k; 
	if(k>=a+b) ans=a-(k-a-b);
	else if(k>=a) ans=a;
	else ans=k;
	cout<<ans;
	return 0;
}

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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long



int32_t main() {

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

    int ans = b*(t/a);

    cout << ans << endl;
    
    return 0;
}


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

using namespace std;

const int mod = 1e9 + 7;

int main()
{
  int N;
  string S1, S2;
  cin >> N >> S1 >> S2;
  long long ans = 1;
  for (int i = 0; i < N; i++)
  {
    if (S1[i] == S2[i])
    {
      if (i == 0)
        ans *= 3;
      else if (S1[i - 1] == S2[i - 1])
        ans *= 2;
    }
    else
    {
      if (i == 0)
        ans *= 6;
      else if (S1[i - 1] == S2[i - 1])
        ans *= 2;
      else
        ans *= 3;
      i++;
    }
    ans %= mod;
  }
  cout << ans % mod << endl;

  return 0;
}


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

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

}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int N,K;
  cin >> N >> K;
  int ans;
  int now;
  for (int cnt = 1; cnt <= 1000000; cnt++) {
    if (cnt == 1) {
      now += K;
    } else {
      now += K-1;
    }
    if (now >= N) {
      ans = cnt;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
#define MAXN 20000005
#define int long long
int n;
int a[MAXN],v[MAXN];
int resp=0LL;
int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;

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

    for(int i=1;i<=n;i++){
        if(a[i]>0){
        resp+=a[i]*(a[i]-1)/2;
        }
    }

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


}

Measured memory_bytes: 8320
#include <bits/stdc++.h>
#include <math.h>
#include <algorithm>
#include <cstdlib>
#include <string>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define f first
#define s second
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define eb emplace_back
#define in insert
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define FOR(i, n, x) for(int i = x; i < n; i++)
#define OUT(a, e) FOR(i, e, 0) cout << a[i] << ' '
#define OUTV(a) for(auto e : a) cout << e << ' ';
#define maxim(a, n, mx) FOR(i, n, x)mx = max(mx, a[i]);


using namespace std;

const int N = 26;


int main()
{
    int n; cin >> n;
    int a[n];
    FOR(i, n, 0)cin >> a[i];
    int is = 0;
    FOR(i, n, 0)
    {
        if(a[i] % 2)continue;
        if(a[i] % 2 == 0 && (a[i] % 3 == 0 || a[i] % 5 == 0))continue;
        is = 1;
    }
    if(is)cout << "DENIED";
    else cout << "APPROVED" << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;

int main(void) {
  string a;
  cin >> a;

  map<char, ll> mp;
  for (auto i : a) {
    mp[i]++;
  }

  ll ans = (ll)a.size() * (a.size() - 1) / 2;
  for (auto i : mp) {
    ans -= i.second * (i.second - 1) / 2;
  }
  cout << ans + 1 << endl;

  return 0;
}

Measured memory_bytes: 640
using System;
using System.Diagnostics;
using System.Collections.Generic;

class Myon

{
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }
    static Scanner cin;


    int N;
    long[] A;
    long[] dp;
    void calc()
    {
        N = cin.nextInt();
        A = cin.ArrayLong(N);
        dp = new long[N + 1];
        for (int i = 0; i < N; i++)
        {
            dp[i + 1] = dp[i] + A[i];
        }

        long ans = long.MaxValue;

        int d1 = 1;
        int d2 = 3;
        for (int c = 2; c <= N - 2; c++)
        {
            if (c == d2) d2++;

            long A = sum(0, d1);
            long B = sum(d1, c);
            long C = sum(c, d2);
            long D = sum(d2, N);
            while(A < B && d1 < c)
            {
                d1++;
                A = sum(0, d1);
                B = sum(d1, c);
            }
            while (C < D && d2 < N)
            {
                d2++;
                C = sum(c, d2);
                D = sum(d2, N);
            }

            ans = Math.Min(ans, maxmin4(sum(0, d1), sum(d1, c), sum(c, d2), sum(d2, N)));
            ans = Math.Min(ans, maxmin4(sum(0, d1), sum(d1, c), sum(c, d2-1), sum(d2-1, N)));
            ans = Math.Min(ans, maxmin4(sum(0, d1-1), sum(d1-1, c), sum(c, d2), sum(d2, N)));
            ans = Math.Min(ans, maxmin4(sum(0, d1-1), sum(d1-1, c), sum(c, d2-1), sum(d2-1, N)));

        }
        Console.WriteLine(ans);


    }

    long maxmin4(long a, long b, long c, long d)
    {
        return Math.Max(Math.Max(a, b), Math.Max(c, d)) - Math.Min(Math.Min(a, b), Math.Min(c, d));
    }

    long sum(int a, int b)
    {
        return dp[b] - dp[a];
    }
    
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}




Measured memory_bytes: 32604
def gets; ARGF.gets; end

def main
  n, m = gets.split.map(&:to_i)

  # ハッシュ: 累積mod -> その個数
  accum_mod_hash = Hash.new(0)
  accum_mod = 0
  gets.split.each do |s|
    accum_mod = (s.to_i + accum_mod) % m
    accum_mod_hash[accum_mod] += 1
  end
  # pp accum_mod_hash

  ans = accum_mod_hash.inject(0) do |sum, (k, v)|
    if k == 0
      sum += v * (v+1) / 2
    else
      sum += (v-1) * (v) / 2
    end
    sum
  end

  puts ans
end

if __FILE__ == $0
  main
end


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

int main() {
  int M,D;
  cin >> M >> D;
  int Z = 0;
  
  for(int i=1;i<=D;i++) {
    int j = i/10;
    int K = i%10;
    
    if(j >= 2 && K >= 2){
      if(j*K <= M){
        Z = Z+1;
      }
      else{
        Z = Z+0;
      }
    }
    else{
      Z = Z+0;
    }
  }
  
  cout << Z << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define REP(i, n) FOR(i, 0, n)
#define INF 999999999
typedef long long ll;
using namespace std;
int main() {
    int X, t;
    cin >> X >> t;
    int ans;
    if(t > X) {
        ans = 0;
    }else{
        ans = X - t;
    }
    cout << ans << "\n";
}

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

int main() {
	string a;
	int b,fl=0;
	char c[26];
	cin >> a;
	b=a.size();
	c[0]=a[0];
	for(int i=1;i<b;i++){
		for(int j=0;j<i;j++){
			if(a[i]==c[j]) fl=1;
			c[i]=a[i];
		}
	}
	if(fl==1) cout<< "no" << endl;
	if(fl==0) cout << "yes" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();

        int n = Integer.parseInt(br.readLine());

        int taroPoint = 0;
        int hanakoPoint = 0;

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

            String input = br.readLine();
            String[] card = input.split(" ");

            String taro = card[0];
            String hanako = card[1];

            if(taro.compareTo(hanako) > 0){
                taroPoint += 3;
            }else if(taro.compareTo(hanako) < 0){
                hanakoPoint += 3;
            }else{
                taroPoint++;
                hanakoPoint++;
            }
        }
        sb.append(taroPoint).append(" ").append(hanakoPoint);
        System.out.println(sb);
    }
}

Measured memory_bytes: 25272
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
typedef long long ll;

int main(){
  int n;
  cin >>n;
  ll ans = 1;
  rep(i,n){
    ll x;
    cin >>x;
    ans = ans/__gcd(ans,x)*x;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<sstream>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(v) for (int i = 0; i < (v).size(); i++) { cin >> (v)[i]; }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}
int x = 0, y = 0, z = 0, n = 0; string s = ""; asas; cncn;
int main(void) {
	cin >> n;
	vcha s(n);
	rep(i, n) {
		cin >> s[i];
		if (s[i] == 'Y') {
			cout << "Four" << rt;
			return 0;
		}
	}
	cout << "Three" << rt;
	please AC;
}

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

int main(void)
{
	while(1) {
		int m, f, r;
		int sum;
		char grade;

		cin >> m >> f >> r;

		sum = m + f;
		if(m == -1 && f == -1 && r == -1)		break;
		if(m == -1 || f == -1 || sum < 30)		grade = 'F';
		else if(sum >= 30 && sum < 50) {
			if(r >= 50)			grade = 'C';
			else				grade = 'D';
		}
		else if(sum >= 50 && sum < 65)			grade = 'C';
		else if(sum >= 65 && sum < 80)			grade = 'B';
		else									grade = 'A';

		cout << grade << endl;
	}

	return 0;
}

Measured memory_bytes: 1152
n,m=map(int,input().split())
p=list(map(int,input().split()))
tree=[i for i in range(0,n+1)]

def root(x,tree):
    if x==tree[x]:
        return x
    else:
        tree[x]=root(tree[x],tree)
        return root(tree[x],tree)

def union(x,y,tree):
    a=root(x,tree)
    b=root(y,tree)
    if a==b:
        return
    else:
        tree[a]=b

ans=n


for i in range(m):
    x,y=map(int,input().split())
    union(x,y,tree)

for i in range(n):
    if  root(p[i],tree)!=root(i+1,tree):
        ans-=1
print(ans)

Measured memory_bytes: 13812
import sys
readline = sys.stdin.readline
from heapq import heapify, heappush, heappop

def main():
    N, M = map(int, readline().rstrip().split())
    inp = [list(map(int, readline().rstrip().split())) for _ in range(M)]
    pref = {}
    for p, y in inp:
        pref.setdefault(p, [])
        pref[p].append(y)

    pref_year_id = {}
    for p, years in pref.items():
        heapify(years)
        p_id = str(p).zfill(6)
        pref_year_id[p] = {}
        for i in range(1, len(years)+1):
            year = heappop((years))
            pref_year_id[p][year] = p_id + str(i).zfill(6)
    
    for p, y in inp:
        print(pref_year_id[p][y])

if __name__ == '__main__':
    main()

Measured memory_bytes: 83552
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<vector>
#include<algorithm>
using namespace std;

struct str
{
	int a, b, c;
	void new_str(int a_, int b_, int c_){
		a = a_; b = b_; c = c_;
	}
};
int dp[200][200];
int t[200];
str cl[200];
int main(){
	int d, n;
	scanf("%d%d", &d, &n);
	memset(dp, -1, sizeof(dp));
	for (int i = 0; i < d; i++)
		scanf("%d", &t[i]);
	for (int i = 0; i < n; i++){
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		cl[i].new_str(a, b, c);
	}
	for (int i = 0; i < n; i++)
		if (cl[i].a <= t[0] && t[0] <= cl[i].b)
			dp[0][i] = 0;
	for (int i = 1; i < d; i++){
		for (int j = 0; j < n; j++){
			if (cl[j].a <= t[i] && t[i] <= cl[j].b){
				for (int l = 0; l < n; l++){
					if (dp[i - 1][l] >= 0 && abs(cl[l].c - cl[j].c) + dp[i - 1][l]>dp[i][j])
						dp[i][j] = abs(cl[l].c - cl[j].c) + dp[i - 1][l];
				}
			}
		}
	}
	printf("%d\n", *max_element(dp[d - 1], dp[d - 1] + n));
	return 0;
}

Measured memory_bytes: 2804
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
int s[1010][1010];
signed main(){
  int n;
  cin>>n;
  memset(s,0,sizeof(s));
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      if((i+j)%2==0) s[i][j]=1;
  for(int i=0;i<n;i+=3)
    for(int j=0;j<n;j++)
      s[i][j]=1;
  for(int j=0;j<n;j++)
    s[n-1][j]=1;
  for(int i=0;i<n;i++)
    s[i][0]=1;

  using P = pair<int, int>;
  vector<P> ans;
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      if(((i+j)&1)&&s[i][j]) ans.emplace_back(i,j);

  cout<<ans.size()<<endl;
  for(auto p:ans) cout<<p.first<<" "<<p.second<<endl;
  return 0;
}


Measured memory_bytes: 6896
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<vector>
#include<limits.h>
using namespace std;
#define INF LLONG_MAX
#define inf INT_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
typedef pair<int, int> P;
ll GCD(ll a, ll b) {
	if (b == 0)return a;
	return GCD(b, a%b);
}
ll LCM(ll a, ll b) {
	return a / GCD(a, b)*b;
}
ll mypow(ll a, ll b) {
	if (b == 0)return 1;
	if (b % 2)return mypow(a, b - 1)*a;
	else return mypow(a, b / 2)*mypow(a, b / 2) ;
}
/*
//Conbination!
ll c[51][51];
void comb(int n) {
	rep(i, 51) {
		rep(j, i + 1) {
			if (j == 0 || j == i)c[i][j] = 1;
			else c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
		}
	}
}
*/
int n;
ll a[100010], ans;
int main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i];
		if (i % 2 && sum <= 0) {
			ans += 1 - sum;
			sum = 1;
		}
		else if (i % 2 == 0 && sum >= 0) {
			ans += sum + 1;
			sum = -1;
		}
	}
	ll cnt = 0;
	sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i];
		if (i % 2 && sum >= 0) {
			cnt += sum + 1;
			sum = -1;
		}
		else if (i % 2 == 0 && sum <= 0) {
			cnt += 1 - sum;
			sum = 1;
		}
	}
	cout << min(ans, cnt) << endl;
	return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] a) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int x;
		try {
			x = Integer.parseInt(br.readLine());
			System.out.println(String.valueOf(x*x*x));
		}  catch (IOException e) {
			e.printStackTrace();
		}
	}
}


Measured memory_bytes: 24304
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <numeric>
#include <float.h>
#include <math.h>
using namespace std;
// repマクロの定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロの定義
#define all(v) v.begin(), v.end()

typedef unsigned long long ll;


int main(){ 
ll N,M; cin >> N >> M;
ll ans = N*M;
ll sub;
if(N == 1 && M == 1){
     sub = 0;
}
else if(N == 1 || M == 1){
     sub = 2;
}
else{
     sub = N * 2 + M * 2 - 4 ;
}
cout << ans - sub << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int h,w;
vs a;

int main(){
	cin>>h>>w;
	a=vs(h);
	queue<pip> q;
	for(auto &i:a) cin>>i;
	for(int i=0;i<h;i++) for(int j=0;j<w;j++) if(a[i][j]=='#') q.push({0,{i,j}});
	int res=0;
	while(!q.empty()){
		pip p=q.front();q.pop();
		int d=p.first,i=p.second.first,j=p.second.second;
		for(int k=0;k<4;k++){
			int x=i+dx[k],y=j+dy[k];
			if(x>=0&&x<h&&y>=0&&y<w&&a[x][y]=='.'){
				a[x][y]='#';
				res=max(res,d+1);
				q.push({d+1,{x,y}});
			}
		}
	}
	cout<<res<<endl;
}

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

#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl '\n'
#define elif else if
#define lli long long int
#define ld long double
#define vec vector
#define forn(a) for(lli a=0; a<n; a++)
#define all(x) x.begin(), x.end()
#define presicion(x) cout<<fixed<<setprecision(x)
#define deb(x) cerr<<#x<<" = "<<x<<endl

using namespace std;

int main() {
    IOS;


    bool cuatro = false;
    bool dos = false;
    bool uno = false;

    int cont = 0;
    int n; cin>>n;
    while(true){
        cont++;

        if(n==4 & not cuatro){
            cuatro = true;
        }elif(n==4 & cuatro){
            cout<<cont<<endl;
            return 0;
        }elif(n==2 & not dos){
            dos = true;
        }elif(n==2 & dos){
            cout<<cont<<endl;
            return 0;
        }elif(n==1 & not uno){
            uno = true;
        }elif(n==1 & uno){
            cout<<cont<<endl;
            return 0;
        }

        if(n%2==0) n/=2;
        else n = 3*n+1;

    }

    return 0;
}

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

int main(void) {
  long n, k, *a, i, dif;

  scanf("%ld %ld", &n, &k);

  a = malloc(sizeof(long) * n);

  for (i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }

  if (n > k) {
    dif = (n - k) / (k - 1);
    if ((n - k) % (k - 1) == 0) {
      printf("%ld\n", dif + 1);
    }else {
      printf("%ld\n", dif + 2);
    }
  }else {
    printf("1\n");
  }

  return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define SORT(x) (sort(x.begin(),x.end()))
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main() {
    int N;cin >> N;
    double v[107];
    rep(i,N){
        cin >> v[i];
    }
    sort(v,v+N);
    double ans=v[0];
    rep(i,N-1){
        ans+=v[i+1];
        ans/=2;
    }
    printf("%lf",ans);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define elnd endl //* missspell check
const ll INF = 1LL << 60;

void neg(vll a){
    REP(i, a.size()) a[i] = -a[i];
}

void solve(long long N, long long M, std::vector<long long> x, std::vector<long long> y, std::vector<long long> z){
    ll ans = 0;
    REP(S, 1LL<<3){
        vll tmp(N, 0);
        REP(i, N){
            if(S>>0 & 1) tmp[i] += -x[i];
            else tmp[i] += x[i];
            if(S>>1 & 1) tmp[i] += -y[i];
            else tmp[i] += y[i];
            if(S>>2 & 1) tmp[i] += -z[i];
            else tmp[i] += z[i];
        }
        sort(ALL(tmp)); reverse(ALL(tmp));
        ll tmpsum = 0;
        REP(i, M) tmpsum += tmp[i];
        ans = max(ans, tmpsum);
    }
    cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> x(N);
    std::vector<long long> y(N);
    std::vector<long long> z(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
        scanf("%lld",&z[i]);
    }
    solve(N, M, std::move(x), std::move(y), std::move(z));
    return 0;
}


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

o = gets.chomp.split('')
e = gets.chomp.split('')

loop do
  if o.size != 0
    print o.shift
  end

  if e.size != 0
    print e.shift
  end

  if o.size == 0 && e.size == 0
    break
  end
end
puts


Measured memory_bytes: 1788
// {{{ by shik
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

#ifdef SHIK
template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) do { \
    fprintf(stderr, "%s:%d - ", __PRETTY_FUNCTION__, __LINE__); \
    _dump(#__VA_ARGS__, __VA_ARGS__); \
} while (0)

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T, size_t N>
ostream& operator <<( ostream &s, const array<T,N> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }
#else
#define dump(...)
#endif

template<typename T>
void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( long long &x ) { scanf("%" PRId64,&x); }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }

void R() {}
template<typename T, typename... U>
void R( T& head, U&... tail ) {
    _R(head);
    R(tail...);
}

template<typename T>
void _W( const T &x ) { cout<<x; }
void _W( const int &x ) { printf("%d",x); }
template<typename T>
void _W( const vector<T> &x ) {
    for ( auto i=x.cbegin(); i!=x.cend(); i++ ) {
        if ( i!=x.cbegin() ) putchar(' ');
        _W(*i);
    }
}

void W() {}
template<typename T, typename... U>
void W( const T& head, const U&... tail ) {
    _W(head);
    putchar(sizeof...(tail)?' ':'\n');
    W(tail...);
}

#ifdef SHIK
#define FILEIO(...)
#else
#define FILEIO(name) do {\
    freopen(name ".in","r",stdin); \
    freopen(name ".out","w",stdout); \
} while (0)
#endif

// }}}

const int N=1e5+10;
int n,a[N];
int main() {
    R(n);
    REP(i,n) R(a[i]);
    LL ans=0;
    int r=0;
    REP(i,n) {
        ans+=(a[i]+r)/2;
        if ( a[i]!=0 ) r=(a[i]+r)%2;
        else r=0;
    }
    W(ans);
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#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 mp make_pair
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define INF 0x3f3f3f3f
typedef long long ll;
typedef pair<ll,ll> pii;
typedef pair<double,double> pdd;
ll n,m;
int main()
{
    //IOS;
    while(cin>>n)
    {
        if(n%2==0) cout<<"0.5\n";
        else
        {
            double ans=double(n/2+1)/double(n);
            cout<<fixed<<setprecision(6)<<ans<<'\n';
        }
    }
        

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define x first
#define y second
#define pb push_back
#define ll long long
#define int ll
#define ld long double
#define ii pair<int, int>
#define iii pair<int, ii>
#define vi vector<int>
#define vii vector<ii>
#define pq priority_queue
using namespace std;
const int ms = 1100;
const int mod = 1e9+7;
const int inf = 1e9 + 100;
const int sigma = 30;
int n, m, k, t = 1;
string a, b;

string ele[ms];

int dp[ms][ms];
int seen[ms][ms];

int sol(int i, int j){
  if(i>=n || j>=m) return 0;
  if(ele[i][j]=='#') return 0;
  if(i==n-1 && j==m-1) return 1;

  if(seen[i][j]) return dp[i][j];
  seen[i][j] = 1;

  return dp[i][j] = (sol(i+1, j) + sol(i, j+1))%mod;
}

void solve(){
  cin>>n>>m;
  for(int i=0; i<n; i++){
    cin>>ele[i];
  }
  cout<<sol(0, 0)<<endl;
}

int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  while(t--){
    solve();
  }
}

Measured memory_bytes: 19840
#include <bits/stdc++.h>
using namespace std;
	
typedef long long ll;
typedef unsigned long long ull;
typedef long double db;
	
#define MOD 1000000007
#define mi 18446744073709551615
#define ff first
#define ss second
#define pb push_back
#define vii vector<int>
#define pii pair<int,int>
#define vpii vector<pii>

int n,c;
vii a[200005];
bool vis[200005]={};

void dfs(int s)
{
	if(vis[s]==true)
		return;
	vis[s]=true;
	c++;
	for(int i:a[s])
		dfs(i);
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int T=1;
	//cin>>T;
	while(T--)
	{
		int m,t1,t2,ans=0;
		cin>>n>>m;
		for(int i=0;i<m;i++)
		{
			cin>>t1>>t2;
			a[t1].push_back(t2);
			a[t2].push_back(t1);
		}
		for(int i=1;i<=n;i++)
		{
			c=0;
			if(!vis[i])
				dfs(i);
			ans=max(ans,c);
		}
		cout<<ans;
	}  
	return 0;
}

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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii; typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	ll n, d;
	cin >>n >>d;
	int ans = 0;
	
	rep(i, n){
		ll x, y;
		cin >>x >>y;
		if(x*x + y*y <= d*d) ans++;
	}
	
	
	cout << ans <<"\n";
	return 0;
}



Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define INF 999999999
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define Vecpr vector<pair<lli,lli>>
int main() {
  lli A,B,C,D;
  string a,b,c;
  cin >>a;
  b="ABC"+a;
  Out(b);
}


Measured memory_bytes: 256
char buf[5];
char out[2<<17];
sz;outsz;
N;
char fs[]="1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n6\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n7\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n6\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n8\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n6\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n7\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n6\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n9\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n6\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n7\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n6\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n8\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n6\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n7\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n6\n1\n2\n1\n3\n1\n2\n1\n4\n1\n2\n1\n3\n1\n2\n1\n5\n1\n2\n1\n";
main(){
	read(0,buf,5);
	for(;;)
	{
		char k=buf[sz++];
		if(k<'0')break;
		N=N*10+k-'0';
	}
	for(;--N;)
	{
		memcpy(out+outsz,fs,2*N);
		outsz+=2*N;
	}
	write(1,out,outsz);
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <string>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>

using namespace std;

// ---------------------
// repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

// ---------------------
#define INF 922337203685477580
#define IINF (1<<21)
typedef long long ll;

int V, E;
vector<pair<int, int> > G[10100];
priority_queue<pair<int, int> , vector<pair<int, int> >, greater<pair<int, int> > > Q;

int main() {
  cin >> V >> E;

  int visited[V];
  int d[V];
  int p[V];

  REP(i, E) {
    int s, t, w;
    cin >> s >> t >> w;

    G[s].push_back(make_pair(t, w));
    G[t].push_back(make_pair(s, w));
  }
  REP(i, V) {
    visited[i] = 0;
    p[i] = -1;
    d[i] = IINF;
  }


  d[0] = 0;
  Q.push(make_pair(d[0], 0));

  // REP(_, V) {
  while (!Q.empty()) {
    // int mincost = IINF;
    // int minv = -1;
    // REP(v, V) {
    //   if (!visited[v] && d[v] < mincost) {
    //     minv = v;
    //     mincost = d[v];
    //   }
    // }
    int mincost = Q.top().first;
    int minv = Q.top().second;
    Q.pop();
    visited[minv] = 1;

    for (vector<pair<int, int> >::iterator it = G[minv].begin(); it != G[minv].end(); it++) {
      int v = it->first;
      int w = it->second;

      if (!visited[v] && w < d[v]) {
        d[v] = w;
        p[v] = minv;
        Q.push(make_pair(d[v], v));
      }
    }
  }

  ll sum = 0;
  REP(i, V) {
    if (p[i] != -1) {
      for (vector<pair<int, int> >::iterator it = G[i].begin(); it != G[i].end(); it++) {
        if (it->first == p[i]) {
          sum += it->second;
          break;
        }
      }
    }
  }

  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 6168
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for (int i = 1;; i++) {
            int x = sc.nextInt();
            if (x == 0) {
                break;
            }
            System.out.printf("Case %d: %d\n", i, x);
        }
        sc.close();
    }
}



Measured memory_bytes: 66508